On Thu, Aug 28, 2014 at 11:50 AM, Koen Kooi <k...@dominion.thruhere.net> wrote:
>
> Hi,
>
> I am working on a system (http://www.acmesystems.it/arietta) where I hooked 
> up the button as a power key:
>
>         
> https://github.com/koenkooi/linux/commit/c823e0b046efcfff61e21fa4c89d5d68090ef6de
>
> Evtest shows it doing the right thing (issuing KEY_POWER) when being pressed, 
> but systemd seems to totally ignore it. I've seen this behaviour in the past 
> and noticed the DE (GNOME2, old but it works) would pick it up and present 
> the dialog. Since this is a headless system I want systemd to handle it 
> instead of the DE (which isn't installed).

Yes, systemd-logind handles the key events, unless something inhibits
this. For example, GNOME 3 does:

$ systemd-inhibit --list
     Who: grawity (UID 1000/grawity, PID 945/gnome-settings-)
    What: handle-power-key:handle-suspend-key:handle-hibernate-key
     Why: GNOME handling keypresses
    Mode: block

> Every doc or blog post I read says that systemd should already be handling 
> it, but it isn't in my case. I suspect that systemd only handles ACPI 
> powerkey events, but I haven't actually looked at the code.

It receives the events via /dev/input, whether ACPI or not. Reading
src/login/logind-button.c:155, it checks for either KEY_POWER or
KEY_POWER2.

Make sure it correctly detects your input device. You should be seeing
something like this in the logs:

logind[388]: New seat seat0.
logind[388]: Watching system buttons on /dev/input/event3 (Power Button)
logind[388]: Watching system buttons on /dev/input/event4 (Video Bus)
logind[388]: Watching system buttons on /dev/input/event1 (Lid Switch)
logind[388]: Watching system buttons on /dev/input/event2 (Sleep Button)
logind[388]: New session c1 of user gdm.
logind[388]: Lid closed.

-- 
Mantas Mikulėnas <graw...@gmail.com>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to