You are not logged in.

#1 2024-11-26 23:32:19

kennelh
Member
Registered: 2024-11-26
Posts: 2

Unable to assign scancodes on Lenovo Ideapad laptop

I've got Arch running on a Lenovo Ideapad 5i laptop.  The keyboard has three function keys (F4, F8, and F9) which are handled separately from the keyboard (keyboard is /dev/input/event2, buttons are /dev/input/event8).  The F4 and F8 do not report a scancode using showkey -s, but both report keycode 240 with showkey -k.  If I run evtest /dev/input/event8, F4 shows a value of 0x13e and F8 shows 0x13f. 

Using the instructions for Map scancodes to keycodes I created the file /etc/udev/hwdb.d/11-ideapad.hwdb:

evdev:input:b0019v0000p0000e0000*
  KEYBOARD_KEY_13e=media
  KEYBOARD_KEY_13f=battery

I then run systemd-hwdb update and udevadm trigger, then run udevadm info /dev/input/event8 | grep KEYBOARD_KEY to verify the keys are there.  However, the two keys still return keycode of 240.

If it makes any difference, I'm using KDE Plasma 6 and running Wayland.

Offline

#2 2024-11-27 22:09:35

mesaprotector
Member
Registered: 2024-03-03
Posts: 167

Re: Unable to assign scancodes on Lenovo Ideapad laptop

Perhaps you're missing a module; there is an ideapad_laptop kernel module which on my Lenovo is responsible for F4, F8, and F10.

Failing that, have you tried the third method on the "map scancodes to keycodes" page? I ask because a scancode of 0x... is likely to be exactly the sort that the kernel would complain about, in which case you'd need to set them with /usr/bin/setkeycodes at boot.

It's also possible to map keycode 240 to an action with a high-level keyboard utility (using hwdb/udev directly is low-level), but that's not likely what you want, since it wouldn't discriminate between F4, F8, or anything else that sends keycode 240.

Offline

#3 2024-11-28 00:54:11

kennelh
Member
Registered: 2024-11-26
Posts: 2

Re: Unable to assign scancodes on Lenovo Ideapad laptop

mesaprotector wrote:

Perhaps you're missing a module; there is an ideapad_laptop kernel module which on my Lenovo is responsible for F4, F8, and F10.

Failing that, have you tried the third method on the "map scancodes to keycodes" page? I ask because a scancode of 0x... is likely to be exactly the sort that the kernel would complain about, in which case you'd need to set them with /usr/bin/setkeycodes at boot.

It's also possible to map keycode 240 to an action with a high-level keyboard utility (using hwdb/udev directly is low-level), but that's not likely what you want, since it wouldn't discriminate between F4, F8, or anything else that sends keycode 240.

I discovered today that the most recent version of ideapad_laptop.c does support these keys.  I patched the module, rebuilt and loaded it, and it detects them.  Now I just need to figure out how to assign them to something Wayland can detect.

Offline

Board footer

Powered by FluxBB