You are not logged in.

#1 2013-10-04 08:33:34

kejingzhang
Member
Registered: 2013-09-25
Posts: 8

Remapping keyboard keys using udev hwdb doesn't work on rightAlt

Hi,

I'm trying to use udev hwdb for swapping pairs of keys ( esc, caps_lock ) and ( rightAlt , rightCtrl ) . I followed the instruction here Map Scancodes to Keycodes   with procedures describe blow. I only succeed in exchaging pair (esc, caps_lock) but failed in (rightAlt, rightCtrl).

Details of Procedures:

  1. Create an empty file under /usr/lib64/udev/hwdb.d with file name 90-custom-keys.hwdb . Add the following lines into this file.

    keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pn*
     KEYBOARD_KEY_01=capslock
     KEYBOARD_KEY_3a=esc
     KEYBOARD_KEY_e038=rightctrl
     KEYBOARD_KEY_e01d=rightalt
  2. Rebuilding hwdb.bin

     udevadm hwdb --update 
  3. Testing and reboot my system

    udevadm --debug test  /devices/platform/i8042/serio0/input/input0/event0
    udevadm --debug test-builtin keyboard /devices/platform/i8042/serio0/input/input0/event0

    Parts of the testing result of the last command looks like

    device 0x1ce3890 has devpath '/devices/platform/i8042/serio0/input/input0/event0'
    device 0x1ce3890 filled with db file data
    keyboard: mapping scan code 1 (0x1) to key code 58 (0x3a)
    keyboard: mapping scan code 58 (0x3a) to key code 1 (0x1)
    keyboard: mapping scan code 129 (0x81) to key code 164 (0xa4)
    keyboard: mapping scan code 130 (0x82) to key code 166 (0xa6)
     ......
    keyboard: mapping scan code 164 (0xa4) to key code 166 (0xa6)
    keyboard: mapping scan code 216 (0xd8) to key code 152 (0x98)
    keyboard: mapping scan code 217 (0xd9) to key code 191 (0xbf)
    keyboard: mapping scan code 57373 (0xe01d) to key code 100 (0x64)
    Error calling EVIOCSKEYCODE: Invalid argument
    keyboard: mapping scan code 57400 (0xe038) to key code 97 (0x61)
    Error calling EVIOCSKEYCODE: Invalid argument
    keyboard: mapping scan code 237 (0xed) to key code 226 (0xe2)
    unload module index

    Thie last 6 lines seems to be complaining the  problem, saying that 0xe038  and 0xe01d are invalid scancodes.
    But they are scancodes of rightAlt and rightCtrl respectively, which I got from

    showkey -s

After rebooting the system with the above settings, esc works as caps_lock and caps_lock works as  esc but  rightAlt and rightCtrl has no changes.

Last edited by kejingzhang (2013-10-04 08:51:59)

Offline

#2 2014-08-23 06:35:24

Kiwon Um
Member
Registered: 2014-07-25
Posts: 4

Re: Remapping keyboard keys using udev hwdb doesn't work on rightAlt

For USB keyboard, you need to get the scancodes from evtest rather than showkey. You may find a solution from:
https://ask.fedoraproject.org/en/questi … -keycodes/

Offline

Board footer

Powered by FluxBB