Sunday, November 27, 2011

Middle Mouse Button Scrolling on Linux (Fedora 15)

We need to find the UDI (Unique Device Identifier) for the TrackPoint device. It's an input device and it's a mouse, so let's try to find that capability:
# hal-find-by-capability --capability "input.mouse"
/org/freedesktop/Hal/devices/platform_i8042_i8042_AUX_port_Synaptics_pass_through_logicaldev_input
Only one hit. With that we can get a lot of information about the device:
[root@linuxfed15 conrad]# lshal -u "/org/freedesktop/Hal/devices/usb_device_9da_54f_noserial_if1_logicaldev_input"
udi = '/org/freedesktop/Hal/devices/usb_device_9da_54f_noserial_if1_logicaldev_input'
  info.capabilities = {'input', 'input.mouse'} (string list)
  info.category = 'input'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_9da_54f_noserial_if1'  (string)
  info.product = 'A4TECH USB Device'  (string)
  info.subsystem = 'input'  (string)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_9da_54f_noserial_if1_logicaldev_input'  (string)
  input.device = '/dev/input/event7'  (string)
  input.originating_device = '/org/freedesktop/Hal/devices/usb_device_9da_54f_noserial_if1'  (string)
  input.product = 'A4TECH USB Device'  (string)
  input.x11_driver = 'evdev'  (string)
  linux.device_file = '/dev/input/event7'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'input'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input7/event7'  (string)
# hal-get-property --udi "/org/freedesktop/Hal/devices/platform_i8042_i8042_AUX_port_Synaptics_pass_through_logicaldev_input" --key "info.product" A4TECH USB Device


# hal-get-property --udi "/org/freedesktop/Hal/devices/platform_i8042_i8042_AUX_port_Synaptics_pass_through_logicaldev_input" --key "linux.device_file" /dev/input/event7
Now we can put together a config file in /etc/X11/xorg.conf.d/ :

# nano /etc/X11/xorg.conf.d/42-middle-mouse-scrolling.conf
Section "InputClass"
   Identifier "Middle Mouse Button Scrolling"
   MatchProduct "TPPS/2 IBM TrackPoint"
   MatchDevicePath "/dev/input/event*"
   Option "EmulateWheel" "true"
   Option "EmulateWheelButton" "2"
   Option "XAxisMapping" "6 7"
   Option "YAxisMapping" "4 5"
EndSection
If you dont have yet the conf file just copy/paste from Section down to EndSection and then save.  
NOTE: We're using "/dev/input/event*" instead of "/dev/input/event6"  to make sure our configuration still works should the device path change for any reason
The only thing missing now is a restart of X and we're done. Reboot!


CREDITS TO DENNIS CONRAD

This was edited according to cyb3rc0n's personal fedora15 config settings using A4TECH wireless optical mouse.