Combine xf86-input-evdev middle button + wheel emulation, Kensington Orbit Trackball

This “mouse” is the best thing since sliced bread. No more wrist bending carpal tunnel syndrome inducing table mice for me. Witness the awesomeness for yourself:

In the interest of keeping price low and functions simple, this thing only has two buttons. I now happened to run into a situation where Xorg’s standard wheel and middle button emulation configuration didn’t cut it, because evdev (as of 2.7.3) doesn’t support wheel emulation on top of middle button emulation.

My previous configuration consisted of having the right button do wheel emulation: holding it down and moving the trackball would scroll the document up and down. Single click gives the regular context menu popup etc. Apparently this works for about 99% of the time because I didn’t have a problem until I needed the right button held down for a Tcl/Tk application context menu (hi git gui!).

After finding out I can’t just hold both buttons down (middle button emulation) and scroll with it (wheel emulation on top of middle button emulation) — see above –, doing plenty of remapping logic exercises finally resulted in a configuration that works. Enter third button emulation into the picture, which will replace middle button emulation.

Here’s the final configuration (replace 11 with your device id from “xinput list”):

$ xinput list-props 11
Device 'Kensington      Kensington USB/PS2 Orbit':
	Device Enabled (134):	1
	Coordinate Transformation Matrix (136):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (261):	0
	Device Accel Constant Deceleration (262):	1.000000
	Device Accel Adaptive Deceleration (263):	1.000000
	Device Accel Velocity Scaling (264):	10.000000
	Device Product ID (252):	1149, 4130
	Device Node (253):	"/dev/input/event6"
	Evdev Axis Inversion (560):	0, 0
	Evdev Axes Swap (562):	0
	Axis Labels (563):	"Rel X" (144), "Rel Y" (145)
	Button Labels (564):	"Button Left" (137), "Button Unknown" (559), "Button Right" (139), "Button Wheel Up" (140), "Button Wheel Down" (141)

We disable middle button emulation, because when enabling third button emulation there is no more use for it.

	Evdev Middle Button Emulation (565):	0
	Evdev Middle Button Timeout (566):	50

Hello third button emulation. Because right mouse button will be occupied for wheel emulation, which requires a real non-emulated button, this will be our new right-click that can be held down. Thing to watch out here for is the timeout. I’m finding 400ms delay is about right. Default of 1000ms was definitely annoyingly long. 200ms is too short, you will have trouble selecting text without getting a right-click.

Notice I’m setting the emulated button to “2″. This is for getting apps to keep functioning in a regular expected way.

	Evdev Third Button Emulation (567):	1
	Evdev Third Button Emulation Timeout (568):	400
	Evdev Third Button Emulation Button (569):	2
	Evdev Third Button Emulation Threshold (570):	20

Wheel emulation is all regular stuff, except for setting the emulated button to “3″.

	Evdev Wheel Emulation (571):	1
	Evdev Wheel Emulation Axes (572):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (573):	10
	Evdev Wheel Emulation Timeout (574):	200
	Evdev Wheel Emulation Button (575):	3
	Evdev Drag Lock Buttons (576):	0

And here’s the final piece of the puzzle, reversing buttons “2″ and “3″ mapping. This makes sure the wheel emulation ends up on the real, non-emulated button.

leho@s9 ~ $ xinput get-button-map 11
1 3 2 4 5

To sum it all up, problem solved here is getting a right-click that can be held, while still maintaining wheel emulation, with a 2-button mouse.

Everything in terms of /etc/X11/xorg.conf.d:

leho@s9 ~ $ cat /etc/X11/xorg.conf.d/51-kensington.conf
Section "InputClass"
    Identifier "My Kensington Orbit Trackball"
    Driver "evdev"
    Option "ButtonMapping" "1 3 2 4 5"
    Option "EmulateMiddleButton" "False"
    Option "EmulateThirdButton" "True"
    Option "EmulateThirdButtonButton" "2"
    Option "EmulateThirdButtonMoveThreshold" "0"
    Option "EmulateThirdButtonTimeout" "400"
    Option "EmulateWheel" "True"
    Option "EmulateWheelButton" "3"
    MatchProduct "Kensington USB/PS2 Orbit"

One more parameter needs to be tuned. Default setting of EmulateThirdButtonMoveThreshold 20 disturbs selecting text and drag-n-dropping stuff with the left. You can safely set the threshold to 0, since with a trackball there is pretty much no involuntary movement of the cursor after clicking, like there can be with the regular mouse connected to the whole palm of your hand. 51-kensington.conf has been updated accordingly.

WordPress – a solution to “You do not have sufficient permissions to access this page”

Ran into this wonderful WordPress “feature” with MicroKid Related Posts. I would get the error when saving “Related Posts” admin page options. Search hits like this didn’t apply. Browsing results made it seem like this error could’ve been caused by about a thousand different things, including your dog farting too loud.

Problem: plugin directory name “microkid-related-posts.svn”, since I check them out directly and like to know the scm type used

Solution: remove “.svn” from directory name

Should anyone know why that helps, I’d welcome some hints.

Using interactive commands during emerge ebuild phases

Gentoo Portage’s primary tool emerge is largely meant to run as a non-interactive process. Meaning aside from the –ask flag making it get user confirmation before beginning operations, rest of the process is supposed to finish without any further user input.

This mostly makes sense, because compiling software can be a lengthy process. Even more so when you’re possibly emerging tens of packages at a time. It makes no sense for the user to guard the terminal and stare at the Matrix, waiting to answer the occasional, usually trivial Yes/No prompt.

But in this particular use case I have, I’ve discovered I’d like to run an interactive command etc-update after every package finishes installing (ebuild postinst phase). My goal is to have a firm grip on a vserver bootstrap template configuration with the help of git. Portage’s configuration protection litters /etc with ._cfg* files and I would rather not spread the litter to the git repo by just blindly committing everything in postinst. Also, maintaining the bootstrap template is usually a rare and short operation (few packages at a time) where I can monitor the build and act on request.

Your ${ROOT}/etc/portage/bashrc could have something like this:

echo Phase: $EBUILD_PHASE

case "$EBUILD_PHASE" in
        STATUS=$(eval $GITCMD status -uno -s)
        [ -n "${STATUS}" ] && die "Error: $ETC is not clean"
        eval $GITCMD add $ETC
        eval $GITCMD commit -q -a -m \"emerge $CATEGORY/$P\"

Problem is that emerge pipes everything to its logfiles and won’t let etc-update get any input from you. Some googling revealed a solution by redirecting stdin and stdout. /dev/tty is magic that always has the right answer, google it yourself for details.


        etc-update 0</dev/tty 1>/dev/tty

Install N9 Skype UI on N950

EDIT Share the love, retweet my original announcement!

jflatt at the invaluable tmo forum published an approach to install the N9 version of Real Golf 2011 on N950. It is a mind-numbingly simple task of just adding the N9 apt source repo to your lists.

$ devel-su
Password: rootme
# cd /etc/apt/sources.list.d
# echo "deb ./" > n9.list

“001″ is the device code that replaces “rm680″ for N950. Real Golf requires some additional hacking (see link above), but that is not what I wanted to talk about. First question on my mind was: can I finally get Skype UI installed on the N950 the same way?

Continuing from before:

# apt-get update
# apt-cache search skype
l10n-app-skype - Translation File for application skype
telepathy-spirit - Skype connection manager for Telepathy
account-plugin-skype - Skype plugin for accounts-ui
# apt-get install account-plugin-skype
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 390kB of archives.
After this operation, 1,528kB of additional disk space will be used.
Get: 1 ./ account-plugin-skype 0.85+0m6 [390kB]
Fetched 390kB in 2s (193kB/s)
Selecting previously deselected package account-plugin-skype.
(Reading database ... 44172 files and directories currently installed.)
Unpacking account-plugin-skype (from .../account-plugin-skype_0.85+0m6_armel.deb) ...
aegis-installing account-plugin-skype (from '')
Processing triggers for desktop-file-utils ...
Setting up account-plugin-skype (0.85+0m6) ...
Updating desktop entries... Done

My existing mc-tool’d Skype account did not show up after this procedure. So I removed it.

$ mc-tool list
$ mc-tool remove account-name-here

Then I launched Skype from the fresh new app launcher icon that appeared, entered my account info again, logged in and everything seems fine so far.

I believe it was Jamie Oliver who said: Happy Days!

Prioritize your Google Reader with +tags

Typical situation with Google Reader: not only does your feed list grow like the Nokia snake in short order, but your tags aka folders list will as well. Sooner or later you will have to limit your time spent in the app because it will be impossible to process everything no matter what you do.

Once you’ve accepted this reality (it will take a certain amount of time :>), it starts to make sense to prioritize tags in the display list. This is useful for quickly glancing over key categories without scrolling through your whole list, which helps keep in-app time spent lower and simultaneously keep the mind at ease. “Phew, I did not miss that massively important blog post, another crisis averted!” type thing.

I have found using the format of “+tag” accomplishes this goal when alphabetic sorting is used and is pleasing to the eye, no doubt thanks to Google recently rewiring my brain according to their plus-sized masterplan.

Note that I have everything sorted alphabetically, because the overhead accompanying manual drag-n-drop sorting probably doesn’t assist with the original goal of spending less time with the app.

Bent Pins

tl;dr Apparently I ran into what is known as “bent pins” issue on my S1156-based Gigabyte GA-P55M-UD2 board the other day.

4GB of RAM started to feel cramped and adding another 4GB 1333MHz DDR3 for 20€ sounded reasonable for a 4x2GB configuration.

So I types

shutdown -h now

off comes Antec Remote Fusion top cover, in go the new memory modules, finger hits Power button.. only to see BIOS showing I still have 4GB of total memory.


After one or two CMOS resets, power cycles and a bit of BIOS-exploration, I noticed Gigabyte BIOS M.I.T. Status screen show something strange: all memory sticks were listed for 2048MB, but only two of them were shown as being “Enabled”.

OK, foreseeing some more power cycles here, so disconnecting HDD power cables for a bit seemed reasonable. Let the memory slot testing bonanza begin! Couple of interesting behaviors surfaced.

GA-P55M-UD2 has the following memory slot layout:

|-----------------------------------------| DIMM2
|-----------------------------------------| DIMM1

|-----------------------------------------| DIMM4
|-----------------------------------------| DIMM3

Motherboard manual says two-stick Dual Channel is achieved by placing DIMMs into slot 1 and 3. Yet mine were sitting in slots 1 and 2 instead. At that point I seemed to vaguely recall some issues getting slots 1 and 3 to work together and since 1 and 2 Just Worked(tm), I left them there at the time.

But as we need to know whether Slot 3 actually works at all, I set the layout up again. All I got was a pre-POST reboot loop, which was a pretty good indication of some deeper problem. It’s Google-time for “ga-p55m-ud2 8gb memory” and themsuch queries.

Surprise surprise, turns out this behavior has been seen before and one of the first recommended debugging operations seemed to always be “reseat CPU, check for bent pins”. First I had ever heard of this, you (read: I) would think that if a pin was non-functional, you wouldn’t even get to POST. But this box has been rolling along for a few years now, although with memory sticks possibly being in “wrong” non-Dual-Channel slots.

It was clear now, there was no way to avoid disconnecting the bazillion cables sticking out from the back of the server and digging through desk drawers for that Arctic Silver MX-2 tube. Yawn.

Intel’s instructions for checking sockets:

Looking carefully at the socket pin grid, there indeed seemed to be a spot in upper left corner where a pin seemed to reflect light at a different angle being slightly out of the straight line everybody else was standing in. So I augmented it to the best of my ability with the smallest flathead screwdriver I could find in the house (1mm) and using my girl’s reading glasses as magnifying help. While the pin looked somewhat more in line post-op than before, I am still not entirely sure it’s exactly factory-precision.

In the lower right part there seemed to be something that looked like a small part of a fingernail stuck between pins. So for good measures and while I was at it anyway, I patted myself on the shoulder for job obviously well done on the previous CPU installation and dug the unidentified object out of the socket. Was kinda disappointed the cooking heat of the CPU didn’t turn it into a precious jewel of some kind. Would’ve felt nice to get profit out of gcc and kernel compilations.

After some cursing at S1156 HSF mounting mechanism when putting Scythe Shuriken back on top of the CPU, machine was ready to be tested again.

  • #1 Slot 1 and 3 Dual Channel test: machine now booted instead of reboot-loop, PASSED
  • #2 Slot 2 and 4 Dual Channel test: pre-POST reboot-loop, although I’m not entirely sure this is even supposed to work, FAILED
  • #3 Install all four 2GB sticks: BIOS shows 8GB of memory, BIOS M.I.T. Status screen shows all four sticks as enabled, PASSED

So all in all, happy days.

Based on the above, I’d say bent pins inside the CPU socket causing your memory problems is a real good possibility. Definitely check socket, adjust pins and reseat CPU before you convert the motherboard into being a part of your frisbee equipment.

What I’m wondering now is what happens when different pins are out of alignment. Is it always memory issues, or different bad things happen or to what extent the CPU is capable of functioning in general?