Control: retitle -1 With HandlePowerKeyLongPress=shutdown configured, a short 
press is interpreted as long press

On Thursday, 13 July 2023 20:00:54 CEST Diederik de Haas wrote:
> > > When I created /etc/systemd/logind.conf.d/custom.conf with
> > > HandlePowerKey=ignore
> > 
> > If this is the whole content of /etc/systemd/logind.conf.d/custom.conf,
> > you are missing a [Login] section at the top of the file
> 
> It was the whole contents.
> Adding the "[Login]" header (back) made it work \o/
> 
> I initially had that header, but in my attempts to get it to work, I removed
> it again. I must have done something else wrong in my earlier attempts
> which made it not work then, but I won't be able to recall exactly what.

It looks like there actually is a bug and not (just) a PEBKAC issue.
What I (actually) started out with, was the following custom config:
```
[Login]
HandlePowerKey=suspend
HandlePowerKeyLongPress=poweroff
```

And when I then pressed the power key *short*, it powered off the system.
My initial conclusion that logind.conf.d/custom.conf didn't work was incorrect.

If I remove or disable (via prepending it with '#') the LongPress action, then
it sees it as a short key press and does the desired thing: suspend.
If I set the LongPress action to 'ignore', then it also registers a short key
press as a short press and does the desired thing: suspend.
But if I set the LongPress action to 'shutdown', then it registers a short key
press as a *long* press and does the poweroff action.

Attached you'll find the custom config I used (same as quoted above) and
also the output from journalctl where all my physical key presses were short.
[Login]
HandlePowerKey=suspend
HandlePowerKeyLongPress=poweroff
debian@pinetab2:/etc/systemd$ sudo journalctl -u systemd-logind --since "-1h"
jul 15 09:15:23 pinetab2 systemd-logind[1561]: Operation 'sleep' finished.
jul 15 09:15:40 pinetab2 systemd-logind[1561]: New session 10 of user debian.
jul 15 09:16:50 pinetab2 systemd[1]: Stopping systemd-logind.service - User 
Login Management...
jul 15 09:16:50 pinetab2 systemd[1]: systemd-logind.service: Deactivated 
successfully.
jul 15 09:16:50 pinetab2 systemd[1]: Stopped systemd-logind.service - User 
Login Management.
jul 15 09:16:51 pinetab2 systemd[1]: Starting systemd-logind.service - User 
Login Management...
jul 15 09:16:51 pinetab2 systemd-logind[1742]: New seat seat0.
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event6 (HID 1018:1006)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event9 (HID 1018:1006 System Control)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event10 (HID 1018:1006 Consumer Control)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event1 (rk805 pwrkey)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event2 (dw_hdmi)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: Watching system buttons on 
/dev/input/event0 (gpio-keys)
jul 15 09:16:51 pinetab2 systemd-logind[1742]: New session 2 of user debian.
jul 15 09:16:51 pinetab2 systemd-logind[1742]: New session 10 of user debian.
jul 15 09:16:51 pinetab2 systemd[1]: Started systemd-logind.service - User 
Login Management.
jul 15 09:17:08 pinetab2 systemd-logind[1742]: Power key pressed short.
jul 15 09:17:08 pinetab2 systemd-logind[1742]: Suspending...
jul 15 09:17:29 pinetab2 systemd-logind[1742]: Power key pressed short.
jul 15 09:17:29 pinetab2 systemd-logind[1742]: Operation 'sleep' finished.
jul 15 09:18:31 pinetab2 systemd[1]: Stopping systemd-logind.service - User 
Login Management...
jul 15 09:18:31 pinetab2 systemd[1]: systemd-logind.service: Deactivated 
successfully.
jul 15 09:18:31 pinetab2 systemd[1]: Stopped systemd-logind.service - User 
Login Management.
jul 15 09:18:31 pinetab2 systemd[1]: Starting systemd-logind.service - User 
Login Management...
jul 15 09:18:31 pinetab2 systemd-logind[1850]: New seat seat0.
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event6 (HID 1018:1006)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event9 (HID 1018:1006 System Control)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event10 (HID 1018:1006 Consumer Control)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event1 (rk805 pwrkey)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event2 (dw_hdmi)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: Watching system buttons on 
/dev/input/event0 (gpio-keys)
jul 15 09:18:32 pinetab2 systemd-logind[1850]: New session 2 of user debian.
jul 15 09:18:32 pinetab2 systemd-logind[1850]: New session 10 of user debian.
jul 15 09:18:32 pinetab2 systemd[1]: Started systemd-logind.service - User 
Login Management.
jul 15 09:18:42 pinetab2 systemd-logind[1850]: Power key pressed long.
jul 15 09:18:42 pinetab2 systemd-logind[1850]: Powering off...
jul 15 09:18:42 pinetab2 systemd-logind[1850]: System is powering down.
jul 15 09:18:43 pinetab2 systemd-logind[1850]: Session 10 logged out. Waiting 
for processes to exit.
jul 15 09:18:43 pinetab2 systemd[1]: Stopping systemd-logind.service - User 
Login Management...
jul 15 09:18:43 pinetab2 systemd-logind[1850]: Session 2 logged out. Waiting 
for processes to exit.
jul 15 09:18:43 pinetab2 systemd[1]: systemd-logind.service: Deactivated 
successfully.
jul 15 09:18:43 pinetab2 systemd[1]: Stopped systemd-logind.service - User 
Login Management.
-- Boot d6a0d9b6f2e04fdb83206e6b5c4ee732 --
jul 15 09:19:57 pinetab2 systemd[1]: Starting systemd-logind.service - User 
Login Management...
jul 15 09:19:58 pinetab2 systemd-logind[473]: New seat seat0.
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event1 (HID 1018:1006)
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event7 (HID 1018:1006 Consumer Control)
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event5 (HID 1018:1006 System Control)
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event6 (rk805 pwrkey)
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event4 (dw_hdmi)
jul 15 09:19:58 pinetab2 systemd-logind[473]: Watching system buttons on 
/dev/input/event0 (gpio-keys)
jul 15 09:19:58 pinetab2 systemd[1]: Started systemd-logind.service - User 
Login Management.
jul 15 09:20:08 pinetab2 systemd-logind[473]: New session 1 of user debian.
jul 15 09:25:28 pinetab2 systemd[1]: Stopping systemd-logind.service - User 
Login Management...
jul 15 09:25:28 pinetab2 systemd[1]: systemd-logind.service: Deactivated 
successfully.
jul 15 09:25:28 pinetab2 systemd[1]: Stopped systemd-logind.service - User 
Login Management.
jul 15 09:25:28 pinetab2 systemd[1]: Starting systemd-logind.service - User 
Login Management...
jul 15 09:25:28 pinetab2 systemd-logind[660]: New seat seat0.
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event1 (HID 1018:1006)
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event7 (HID 1018:1006 Consumer Control)
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event5 (HID 1018:1006 System Control)
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event6 (rk805 pwrkey)
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event4 (dw_hdmi)
jul 15 09:25:28 pinetab2 systemd-logind[660]: Watching system buttons on 
/dev/input/event0 (gpio-keys)
jul 15 09:25:28 pinetab2 systemd-logind[660]: New session 1 of user debian.
jul 15 09:25:28 pinetab2 systemd[1]: Started systemd-logind.service - User 
Login Management.
jul 15 09:25:34 pinetab2 systemd-logind[660]: Power key pressed short.
jul 15 09:25:34 pinetab2 systemd-logind[660]: Suspending...
jul 15 09:26:03 pinetab2 systemd-logind[660]: Power key pressed short.
jul 15 09:26:03 pinetab2 systemd-logind[660]: Operation 'sleep' finished.
jul 15 09:37:27 pinetab2 systemd[1]: Stopping systemd-logind.service - User 
Login Management...
jul 15 09:37:27 pinetab2 systemd[1]: systemd-logind.service: Deactivated 
successfully.
jul 15 09:37:27 pinetab2 systemd[1]: Stopped systemd-logind.service - User 
Login Management.
jul 15 09:37:27 pinetab2 systemd[1]: Starting systemd-logind.service - User 
Login Management...
jul 15 09:37:27 pinetab2 systemd-logind[795]: New seat seat0.
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event1 (HID 1018:1006)
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event7 (HID 1018:1006 Consumer Control)
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event5 (HID 1018:1006 System Control)
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event6 (rk805 pwrkey)
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event4 (dw_hdmi)
jul 15 09:37:27 pinetab2 systemd-logind[795]: Watching system buttons on 
/dev/input/event0 (gpio-keys)
jul 15 09:37:28 pinetab2 systemd-logind[795]: New session 1 of user debian.
jul 15 09:37:28 pinetab2 systemd[1]: Started systemd-logind.service - User 
Login Management.
jul 15 09:37:35 pinetab2 systemd-logind[795]: Power key pressed short.
jul 15 09:37:35 pinetab2 systemd-logind[795]: Suspending...
jul 15 09:37:55 pinetab2 systemd-logind[795]: Power key pressed short.
jul 15 09:37:55 pinetab2 systemd-logind[795]: Operation 'sleep' finished.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to