2

I have a laptop, and I save the following to /etc/udev/hwdb.d/90-custom-keyboard.hwdb

keyboard:usb:v*p*
keyboard:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr*
 KEYBOARD_KEY_1a=a
 KEYBOARD_KEY_1b=b

and run

$ sudo udevadm hwdb --update && sudo udevadm trigger

in order to refresh the key mappings.

Now, this is a dummy case that should replace the [ and ] keys with a and b for any USB or dmi keyboard. However, I only get the changes on my laptop's keyboard, and not my other keyboards (a wired and another wireless USB keyboard). I am sure that the same scancodes are sent for all the keyboards I have, regarding the keys I want to remap.

I am using Arch Linux and this is the tutorial I have been looking at.

What do I need to do to make the remapping valid for all USB keyboards that are to be plugged in in the future?

Cadoiz
  • 276
osolmaz
  • 151

1 Answers1

1

The scancodes for usb keyboards are not what you would expect, they are not the output of showkey -s. Instead you pretty much have to use evtest to get the scancodes you need.

Example output from evtest:

Event: time 1399420905.069693, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1399420905.069693, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1399420905.069693, -------------- SYN_REPORT ------------

You want the value after MSC_SCAN, in this case it tells us the button mapped to the A key (KEY_A) has a scancode of 70004.

don_crissti
  • 82,805
Centimane
  • 4,490