[systemd-devel] hardware/system keys/buttons

David Herrmann dh.herrmann at googlemail.com
Sun Dec 30 03:45:44 PST 2012


Hi Tormen

On Wed, Dec 26, 2012 at 5:57 PM, Tormen <quickhelp at gmail.com> wrote:
> Hi David,
>
> Thanks for the answer !
>
> Ok... I see: The mechanism to handle keycodes is not necessary for the power
> button I suppose ;)

The power-button handler reacts on keycodes, not keysyms. That's
actually one of very few examples where handling keycodes does make
sense.

> But still it seems that not a lot would be missing in systemd to allow to
> react to keycodes ?

Can you name a use-case that needs to react on _keycodes_? Because I
really doubt that this is what you want.

> As you mentioned: Auto assigning keysyms gets messy (different hardware,
> differnt keyboard layouts) -> I would start simple and use keycodes.
> (it's what actkbd does)
> Also: How important would portability (from one machine to another be)?

Keyboard-layouts are used for portability. They translate keycodes to keysyms.

The problem with keycodes is that it works for _one_ machine. But once
you copy it over to another machine (or keyboard), it will break
horribly.
There are reasons to react on keycodes (eg., if the location/geometry
of the key is what you want, not the name of the key), however, I'd
rather implement these use-cases in systemd directly, instead of
providing a generic infrastructure.

For your use-cases I really recommend using keysyms (eg., via libxkbcommon).

Regards
David


More information about the systemd-devel mailing list