[ltp] Changing sensitivity ThinkPad USB Keyboard with TrackPoint

Richard Neill linux-thinkpad@linux-thinkpad.org
Thu, 10 May 2012 22:59:43 +0100


On 10/05/12 02:04, Quesillo Quesedor wrote:
> Hello
>
> I have this python script for changing the sensitivity of the trackpoint.

Thanks - that's really useful. I've been looking for something like this 
for ages! Let me check: this is the external USB Ultranav keyboard, not 
the internal one.

I'm having some trouble with this:

1. When I run
	echo XXX > /sys/bus/usb/drivers/usbhid/unbind

I get:   bash: echo: write error: No such device.
(this happens even as root, though the file in /sys does exist).

Btw, I have more than one USB HID device attached - how do we know which 
one is being unbound?


2. My VID/HID aren't as below. Running lsusb, I get two possibilities:

Bus 002 Device 008: ID 04b3:3018 IBM Corp. UltraNav Keyboard
Bus 002 Device 009: ID 06cb:0009 Synaptics, Inc. Composite TouchPad and 
TrackPoint

Trying with either of these causes a python usb.core.USBError: 
Input/output error, but this might be because of the failure to unbind 
the USB hid device.


I think there are 2 different models of Ultranav USB keyboard.

Thanks for your help,

Best wishes,

Richard
.


P.S. Also, can I suggest this would be really useful as an addition to 
Thinkwiki.org?



>
> #pyusb imports
> import usb.core
> import usb.util
>
> data = [0x4, 0x6a, 0x3, 0xfc, 0x38]
> dev = usb.core.find(idVendor=0x17ef, idProduct=0x6009)
> dev.ctrl_transfer(0x21, 0x9, 0x304, 0x1, data)
>
> It needs root to be able to open the device and on linux you need to unbind the trackpoint device from usbhid module before you run the script and then bind it back.
> # echo XXX > /sys/bus/usb/drivers/usbhid/unbind
> # python2 trackpoint-script.py
> # echo XXX > /sys/bus/usb/drivers/usbhid/bind
> I did try to use Device.attach_kernel_driver but it doesn't seems to work for the trackpoint interface.
>
> data[3] is the value that changes the sensitivity level, I found that the windows driver use one of the following values
> 0x66 0x72 0x80 0x8f 0xa0 0xb3 0xc9 0xe1 0xfc
>
> This script also works on OS X.