Systemd-logind HandlePowerKeyLongPress does'nt trigger

Felix Knorr


I'm trying to configure my yocto image that runs on an MS Surface Go 2
to suspend when pressing the power key shortly, and to poweroff if the
key is held longer.

Systemd theoretically supports that by creating the following file:

cat > ${D}/etc/systemd/logind.conf.d/50-ignore-powerbutton.conf

However, while the suspend works, the poweroff does not. For testing I
always set HandlePowerKey to ignore,

systemctl status systemd-logind

shows that the short presses are registered, but the long ones are not.
The event file which corresponds to the power button (in /dev/input/)
show cryptic byte sequences on button down, but nothing on button up.
The output is not always the same, and the number of the event file also
changes (I'm not entirely sure if it changes between reboots or only
between reinstalls)

I noticed that the button module was not included, so I added
CONFIG_ACPI_BUTTON=m to the kernel config, but that didn't help either.
To make the power button work at all I had to include the kernel config:

I suspect that I'm missing some config, but I'm not sure what exactly.
Does anyone have an idea?

Felix Knorr, Dipl. Inf. Software Engineer

neuroloop GmbH
Breisacher Straße 86, 79110 Freiburg, Germany

Handelsregister I Registered place of business: Freiburg/Germany; HRB 713935
Geschäftsführer I Managing director: Michael Lauk

Informationen zur EU-Datenschutzgrundverordnung finden Sie unter:<>

The information contained in this communication is confidential, may be attorney-client privileged, may constitute inside information, and is intended only for the use of the addressee. It is the property of the company of the sender of this e-mail. Unauthorized use, disclosure, or copying of this communication or any part thereof is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return e-mail and destroy this communication and all copies thereof, including all attachments.