My Logitech R400 presenter sends the following key codes:
keycode 112 (keysym 0xff55, Prior) [page up]
keycode 117 (keysym 0xff56, Next) [page down]
keycode 60 (keysym 0x2e, period)
keycode 71 (keysym 0xffc2, F5)
keycode 9 (keysym 0xff1b, Escape)
Basically, I want to use this presenter to remotely control Banshee, so I'd like to remap Prior
to B
, Next
to N
, and so on.
How can I change the keymap for this device only (as I certainly don't want to remap those key codes globally)?
I never did that but I think you need to create a keymap file in
/lib/udev/keymaps/
and add a rule for your device to/lib/udev/rules.d/95-keymap.rules
Details:
An udev keymap maps scan codes to key codes, so you need to find both to create the keymap file. To find the scan codes run the following and press the buttons on the device:
You might need to try different numbers for event*. The output should look like this:
A list of key codes can be found here.
Now create the keymap file (I'm storing it as /lib/udev/keymaps/logitech-r400):
Doesn't do anything useful - just a test to easily see if it works.
To test the new keymap temporarily, run:
which should result in output like this:
The buttons should now change the brightness.
If you want to make that change permanent, you need to add an udev rule to
/lib/udev/rules.d/95-keymap.rules
that applies the keymap file to the device.gksudo gedit /lib/udev/rules.d/95-keymap.rules
At the bottom of the file, but before the
LABEL="keyboard_end"
line, add:Save, close, and after a reboot the buttons should change the brightness.
I'm on Ubuntu 16.04. I made a guide here