You are not logged in.

#1 2022-10-06 21:52:10

satrapes
Member
Registered: 2018-09-25
Posts: 7

[SOLVED] Changing mapping of scancode to keycode for wireless keyboard

Hello,

I have a wireless Logitech mouse and keyboard combo and I want to remap capslock to leftctrl and vice versa for the Linux console as well as the X terminal so I want to use the instructions here https://wiki.archlinux.org/title/Map_sc … o_keycodes
The steps I have followed so far are:

  1. I have identified the scancodes that I am interested in by going to a virtual console with Ctrl+Alt+F1 and running:

    showkey -s

    to reveal the scancodes that I am interested in. These are in decimal so I convert them to hex to get the information I am interested in.

  2. I found the keycode as suggested from the wiki (leftctrl, capslock in lowercase)

  3. To find which /dev/input/eventX corresponds to the wireless devices I run:

    sudo evtest|less

    This will output a list with options which match the Logitech keyboard and mouse. You select the desired option and on the top you can find some nice information.

  4. To determine the whole evdev:input:b*v*p*e*-modalias string that must go into the .hwdb file I run

    cat /sys/class/input/eventX/device/modalias

    where X is found in the previous step

  5. I create a new 61-keyboard.hwdb in /etc/udev/hwdb.d (not in (/usr)/lib/udev/hwdb.d I found that this doesn't update hwdb.bin) and run:

    sudo systemd-hwdb update; sudo udevadm trigger

    and run

    udevadm info /dev/input/by-path/*-*-*-kbd

    to verify that my KEYBOARD_KEY_<HEX_SCANCODE_IN_LOWERCASE_WITHOUT_0x_PREFIX>=<KEYCODE_IN_LOWERCASE>` has been updated correctly

aaaaaand nothing happens.

I have tried rebooting as well but the change never happens.
I have tried globbing the evdev:input: line to make it more general but this has failed to work as well.
One thing that I have noticed is that VC keymap: n/a but I don't know if it helps at all.
[move]I'm moving![/move]
Also I don't know if this is important but I am trying to do this in a Raspberry Pi 4.
Edit: I tried this with a wired keyboard and the same thing happens. I am thinking that may be something is missing from the instructions on the wiki.

I am at my wit's end with this can someone help?

Last edited by satrapes (2022-11-08 10:35:32)

Offline

#2 2022-11-08 10:35:16

satrapes
Member
Registered: 2018-09-25
Posts: 7

Re: [SOLVED] Changing mapping of scancode to keycode for wireless keyboard

Thanks to this video I figured out that the problem was that the scancodes are not what I thought.
To get the value you need to run evtest instead of `showkey -s` and the proper scancode is the value after `MSC_SCAN`. In my case CAPSLOCK was not code 58 but rather code 70039.
I thing the wiki needs some clarification on the subject.

Offline

Board footer

Powered by FluxBB