Thursday, February 26, 2009

Tip of the day - wheel emulation

[update 30 May 2012: add xorg.conf.d snippet] First, run xinput --list --short to identify your mouse device. Let's assume that your mouse is called "USB Mouse".
Then, run the following command:

xinput --set-int-prop "USB Mouse" "Evdev Wheel Emulation" 8 1
xinput --set-int-prop "USB Mouse" "Evdev Wheel Emulation Button" 8 3

Now, holding the right mouse button and moving up and down will scroll. Very useful for reading long articles.

Requirements: evdev 2.1, X server 1.6 and xinput 1.4. Don't forget to check the evdev man page, there's a few extra tweaks related to wheel emulation. xinput is not persistent, but the above can be achieved with the following xorg.conf.d snippet:
Section "InputClass"
   Identifier     "Wheel Emulation"
   MatchIsPointer "on"
   MatchProduct   "USB Mouse"
   Option         "EmulateWheelButton" "3"
   Option         "EmulateWheel" "on"
EndSection
Save this as /etc/X11/xorg.conf.d/99-wheel-emulation.conf and you're good to go. Requires X Server 1.8 or later, for older servers you can do the same by merging the keys input.x11_options.EmulateWheel and input.x11_options.EmulateWheelButton your HAL fdi file.

Tuesday, February 17, 2009

Generic axis support in evdev

After the groundwork by Matt Helsley we now have generic axis support in evdev. So evdev finally sets the device up according to what the kernel reports rather than limiting itself to x/y and potentially pressure.

A truly generic driver. Rejoice.

And because we can, it does axis labeling too (if you have xserver git master, that is).
No more guessing what axis 7 actually is.

The obligatory "screenshot":


whot@roo:~> xinput --list-props "PIXART USB OPTICAL MOUSE" | grep "Axis Labels"
Axis Labels (242): "Rel X", "Rel Y", "Rel Vert Wheel"
whot@roo:~> xinput --list-props "Wacom Intuos3 4x6" | grep "Axis Labels"
Axis Labels (242): "Abs X", "Abs Y", "Abs Z", "Abs Rotary X", "Abs Rotary Z", "Abs
Throttle", "Abs Wheel", "Abs Pressure", "Abs Distance", "Abs Tilt X", "Abs Tilt Y", "Abs Misc"


Expect this to be in evdev 2.2, once it has matured and potential glitches are ironed out.