1

I'am trying to get the brightness control keys (fn + arrows) to work on Arch Linux x64.

So, i get a look into udev rule for my integrated ps/2 laptop keyboard using udevadm info:

P: /devices/platform/i8042/serio0/input/input4/event4
N: input/event4
L: 0
S: input/by-path/platform-i8042-serio-0-event-kbd
E: DEVPATH=/devices/platform/i8042/serio0/input/input4/event4
E: DEVNAME=/dev/input/event4
E: MAJOR=13
E: MINOR=68
E: SUBSYSTEM=input
E: USEC_INITIALIZED=26133209
E: KEYBOARD_KEY_74=prog1
E: KEYBOARD_KEY_75=www
E: KEYBOARD_KEY_78=mail
E: KEYBOARD_KEY_82=!switchvideomode
E: KEYBOARD_KEY_83=!battery
E: KEYBOARD_KEY_84=!prog1
E: KEYBOARD_KEY_86=!wlan
E: KEYBOARD_KEY_88=!brightnessup
E: KEYBOARD_KEY_89=!brightnessdown
E: KEYBOARD_KEY_b1=!prog2
E: KEYBOARD_KEY_b3=!prog3
E: KEYBOARD_KEY_b4=!wlan
E: KEYBOARD_KEY_c5=!prog3
E: KEYBOARD_KEY_d5=!wlan
E: KEYBOARD_KEY_f7=!f22
E: KEYBOARD_KEY_f9=!f23
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_BUS=i8042
E: ID_SERIAL=noserial
E: ID_PATH=platform-i8042-serio-0
E: ID_PATH_TAG=platform-i8042-serio-0
E: LIBINPUT_DEVICE_GROUP=11/1/1:isa0060/serio0
E: DEVLINKS=/dev/input/by-path/platform-i8042-serio-0-event-kbd
E: TAGS=:power-switch:

The https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes says that syntax construction KEYBOARD_KEY_<scancode>=<keycode> binds the keycode to scancode. List of available keycodes can be found here.

As we can see, 88 and 89 scancodes are binded (or not?) to brightness keycodes. This is absolutely correct - i trying to press brightness keys while running evtest - and this generates 88 and 89 scancodes (but keycode information is missing). Pressing this keys while running journactl -f prints next: atkbd serio0: Unknown key pressed (translated set 2, code 0x88 on isa0060/serio0).

So, the problem is, that i just don't understand, that does the "!" symbol mean before keycode? I can't find this syntax case in udev docs.

I guess that this construction unbinds the key from scancode - then I'm at a loss: why would the developer who wrote this rule unbinds this absolutelly correct keys?

1
  • Please post text as text (not a picture). It will make it possible for blind people to read, and easier for everyone else. Commented Feb 24, 2020 at 17:58

1 Answer 1

1

From /lib/udev/hwdb.d/60-keyboard.hwdb

# An '!' as the first character of the key identifier string
# will add the scan code to the AT keyboard's list of scan codes
# where the driver will synthesize a release event and not expect
# it to be generated by the hardware.

There doesn't seem to be other "documentation" beyond that in the systemd source code. hwdb(7) doesn't say anything about it.

4
  • I setup needed keys using setkeycodes e008 225 (e008 is scancode suggested by dmesg, 225 is "KEY_BRIGHTNESSUP" keycode). And here comes another problem: evtest shows that key release is not working: EV_KEY event always has a value '2'. (other keys has 1 on first press, 2 on repeat and 0 on release). So, release event is not generated? Any ideas, why?
    – khokm
    Commented Feb 24, 2020 at 20:00
  • Isn't that exactly what that comment tells you? Keys marked with a bang don't generate a release event, you have to synthesize it.
    – user313992
    Commented Feb 27, 2020 at 5:09
  • Yes, that comment tells that driver will generate it. Actually, it doesn't. I tried both variants - with bang and without (i 100% sure that my custom udev rules was applied, with checking it through udevadm).
    – khokm
    Commented Feb 28, 2020 at 8:51
  • That's not how I interpret it. The way I understand it is: the ! is descriptive and tells you that that specific key will NOT generate a release event, so it's your responsibility to synthesize one (where "you" is the consumer of those events, e.g. the Xorg server or similar). Since there are no docs, better go directly to the systemd people and ask them to document it clearly.
    – user313992
    Commented Feb 29, 2020 at 11:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .