[systemd-devel] Having systemd shutdown when pressing the power button

David Herrmann dh.herrmann at gmail.com
Thu Aug 28 06:38:19 PDT 2014


Hi

On Thu, Aug 28, 2014 at 10:50 AM, Koen Kooi <koen at 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).
> 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.
>
> Are more people experiencing this and does someone have a workaround or fix?

We only open a restricted set of input devices. We don't want logind
to wake up for key-events it's really not interested in (like normal
keyboard events). However, in case KEY_POWER is reported via the same
evdev interface than basic keyboard events, we should really avoid
opening it.

I posted a kernel patch to allow masking input events in April. I have
since resent it 5 times without getting any response... Last revision
is available here:
  https://www.mail-archive.com/linux-input@vger.kernel.org/msg11660.html
First revision from April is here:
  http://www.spinics.net/lists/linux-input/msg30924.html

With that in place, we can open any input device and just mask all
events but KEY_POWER.

Thanks
David


More information about the systemd-devel mailing list