Setting sensitivity of USB Keyboard with Trackpoint
Many thanks for that some kind guys developed the patches for setting the sensitivity of USB Keyboard with Trackpoint. I can move the cursor easily by the trackpoint.
Refer to the following site, the sensitivity can be set easily by using userspace USB functions.
https://github.com/bseibold/tpkbdctl
Alternatively, the sensitivity can be set by Python directly.
首先要 emerge pyusb
然後透過下列指令找到裝置,確定 idVendor=0x17ef, idProduct=0x6009 符合,最末一碼為 0 是鍵盤,1 是trackpoint。
# ls /sys/bus/usb/drivers/usbhid/1-1.5:1.1
在此目錄下會有一個檔名為 0003:17EF:6009.0004
執行下列指令改變 sensitivity
# echo 1-1.5:1.1 > /sys/bus/usb/drivers/usbhid/unbind
# python trackpoint-script.py
# echo 1-1.5:1.1 > /sys/bus/usb/drivers/usbhid/bind
trackpoint-script.py 內容如下
#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)
另外,下面的一些資料,可以做為進一步的參考。
Just for anyone not immediately recognizing the usb_control_msg()
parameters:
0x21 == USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE
0x9 == HID_REQ_SET_REPORT (assuming the interface class is HID)
0x304 == report_type + 1 << 8 | report_id
0x1 == interface number