![]() |
usbhotkey
Remap USB keyboards under X11
|
Home Programming |
The usbhotkey program itself reads USB events from an opened device and calls a ruby function for press and release events. The ruby script given on the command line provides these functions along with some initialisation code to open device. A single USB keyboard can be opened by one instance of usbhotkey. It should be possible to run multiple instances.
The ruby command
UHK_connect( 0x510, 0x100b, 0x81)seaches a USB device with vendor ID 0x510 and product ID 0x100b. If found, it reads events from end-point 0x81. Use lsusb -vvv to find the data for your keyboard.
On keypress the ruby function
UHK_USB_keydn( code)is called. code is the USB scan code.
Only keycodes are sent. These are subject to translation by the current keymap. This calling
USK_keydn( X11::XK_bracketleft)produces a [ on US and UK keyboards, but an u-umlaut (ü) on a German keymap. You may use this feature to generate letters that are not part of the regular keymap by generating unused keycodes and mapping them in ~/.Xmodmap.
A floating overlay can be displayed using
UHK_displayImage( fileName, x, y)