You are not logged in.

#1 2024-10-01 14:35:43

eUser4
Member
Registered: 2024-03-10
Posts: 7

Sleep kbd button multi press causing system not to wake up

I have a PS/2 keyboard with sleep button.
If I accidentally make a multi-press of a button this cause a situation where system does go [deep] sleep but won't wake up. I have to use power button to start  computer.
If I am careful to not cause multi press then system go to sleep as well, but can(correctly) wake up by pressing any kbd button(as I have it set so and was working since ever, on Windows too).
This is 100% reproducible. With single(fast) press I can wake up computer multiple times in row, the moment I dare to do a mistake and cause multi press to register, computer won't wake up on any kbd button press - I have to power on on the case.

I use LXQT + SDDM but it also happened without display manager installed as well.

I have seen a lot of issues on the net about not able to power on from standby and wonder if it could be this. Of course I could use menu, but kbd button is more convenient.

Any idea?

EDIT: Also, I cannot reproduce this under XFCE + LXDM at all, that I have on another disk.

Last edited by eUser4 (2024-10-01 14:43:25)

Offline

#2 2024-10-03 10:01:05

eUser4
Member
Registered: 2024-03-10
Posts: 7

Re: Sleep kbd button multi press causing system not to wake up

I maybe have found the reason by searching online, but I am on the trip and cannot test it before late October.

I found from this: https://man.archlinux.org/man/logind.conf.5 ,that HandleSuspendKeyLongPress= defaults to "hibernate".
As I have a fairly short kbd repeat delay(300ms), there is a possibility that I am causing hibernate on top of suspend, or hibernation alone. Maybe systemd is not locking after initialization correctly, which would still mean bug.
After reading wiki about XFCE I found this one is handling suspend itself, whereas in LXQT this is likely done via systemd.

Offline

#3 2024-10-16 19:24:10

eUser4
Member
Registered: 2024-03-10
Posts: 7

Re: Sleep kbd button multi press causing system not to wake up

Ok so I tried modes like forcing s2idle and changing sleep.conf disabling HandleSuspendKeyLongPress and pretty much everything else. Nothing helped. I don't know if its LXQT or SystemD fault, I just know XFCE works fine.

Offline

#4 2024-10-16 22:07:44

seth
Member
Registered: 2012-09-03
Posts: 57,445

Re: Sleep kbd button multi press causing system not to wake up

If you completely disable the suspendkey handling (don't forget to reload the daemon), does it still do sth. (notably sending the system to sleep on a short press)?
But the "long" duration here is 5 seconds, https://github.com/systemd/systemd/blob … tton.c#L51 - you're not that clumsy, are you?

As for the autorepeat in X11 (assuming the key is bound to some session-specific shortcut):
Does it help if you set the X11 autorepeat delay to 1000ms?

You can disable the autorepeat for individual keycodes, sleep is likely 150, but you'd best figure by running "xev -event keyboard" and pressing that key in a naked session ("startx xterm", no desktop at all)

Offline

#5 2024-10-16 23:21:35

eUser4
Member
Registered: 2024-03-10
Posts: 7

Re: Sleep kbd button multi press causing system not to wake up

Greetings Seth, to your first question seems it does:
I found that disabling all power modes in sleep.conf in /etc/systemd to:
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

+ additionally in GUI of LXQT->power management->power keys disabling suspend key action to "nothing"(same was already for hibernate action, only power key action is set to "shutdown"),
made no difference in that pressing the sleep button still did shut down computer(which I assume went to sleep). That after both daemon-reload and even restart.

One thing this did however was that this time, I could not wake up computer regardless of fast - single press to issue sleep.

When I reverted changes back(that is commented out above lines in sleep.conf which basically turned on all modes) and re-enabled sleep button in LXQT GUI, I am back to where single quick press put in sleep mode where I can wake up back and accidental "double-click" cause system not be able to wake on kbd press. So like before.

I have not yet tried delay, but that won't do because on my kbd(MS natural multimedia keyboard 1.0) sleep button is quite embeded into surrounding plastic and is easy to couse double-click, so solving delay alone is unlikely enough.
I consider this still a bug because once button is registered, it should properly lock into ongoing suspend process and not start doing another thing. XFCE handle this correctly. I just don't know if its LXQT or SystemD issue.

Additionally as a side note I also found that setting in sleep.conf modes like mentioned 'MemorySleepMode=s2idle' do not overwrite /sys/power/mem_sleep, not after daemon-reload nor restart. Only echo s2idle > /sys/power/mem_sleep works.

Offline

#6 Yesterday 06:04:38

seth
Member
Registered: 2012-09-03
Posts: 57,445

Re: Sleep kbd button multi press causing system not to wake up

Ok, we'll first have to figure what actually handles the key.
Boot the multi-user.target, run evtest on the keyboard, then see
1. whether the key suspends the system from the multi-user.target
2. what event it registers (you can tee the output of evtest into some file to log it for later)

Do you run anything lile acpid, keyd etc?

Sidebar:

XFCE + LXDM at all, that I have on another disk … on Windows too

Regardless of how many disks, this counts as dual booting so make sure to see the 3rd link below. Mandatory.
Disable it (it's NOT the BIOS setting!) and reboot windows and linux twice for voodo reasons.

Offline

#7 Yesterday 14:51:48

eUser4
Member
Registered: 2024-03-10
Posts: 7

Re: Sleep kbd button multi press causing system not to wake up

Hello again Seth. Ok so I found something interesting.
First, check the attached screenshot:
screengrab

LXQT acpi buttons relly on 2 independent settings, you need to setup a button shortcut(if its not by default) in shortcuts settings(Global action manager), and then separately in power management enable and chose which acpi button mode to which event will be assigned. If you don't setup both, button doesn't work. This is how I was actually able to disable sleep button. Then running evtest showed its registration to code 142 but system did not went to sleep. So it is controlled via LXQT GUI.

Now I also found that my sleep button is assigned to XF86sleep. By default, what you see on screenshot is default setup of LXQT, except that I disabled XF86PowerOff and XF86Suspend manually. You can see that by default it assign(in my opinion wrongly) XF86Sleep to /powermanager/keyhibernate and XF86Suspend to /powermanager/keysuspend. Those /powermanager/... are not a dirrect shell command and are not editable. My guess is that they link to Power Manager window.

Problem is that Power Manager window does not correctly register those 3 events either. You can see on the picture that(I set it so) only Power key is set to suspend. This is because other 2 have no effect, in another words XF86Sleep in shortcuts is triggering Power key action in Power Manager and not for example Suspend key action or even Hibernate Key action(as it actually should as key is registered to /powermanager/keyhibernate and not /powermanager/keypoweroff).

So its all wrong. Of course by default in Power Manager, Power key action was set to Shutdown, then what I think was happening was that double press was initiating shutdown on top of sleep.

So now with that said, I tried:
-disabling  XF86PowerOff and XF86Suspend and left only XF86Sleep shortcut enabled.
-disabled Suspend and Hibernate key action in power manager and set Power key action to Suspend(since that is what trigger key press).

With this setting I can initiate sleep but waking up still does not work correctly. What it does now is that upon first kbd press it does wake up computer, which start up and is running without turning on monitor for few seconds, then it shut down on its own again. After pressing any kbd button second time, this time computer wake up fully, including monitor. My guess is that this is still because button is registered to /powermanager/keyhibernate and is triggering Power Key action. But at least I am getting closer. This definitely seems to be LXQT issue now, not SystemD.

I would like to figure out how to set XF86Sleep to /powermanager/keysuspend and how to get Power Manager settings to register this to Suspend Key action instead Power Key action. Worst case I may just try to trigger systemctl sleep command(via shortcuts) and bypass LXQT, if that will work.

Any more tips on this are welcome.

EDIT: To your questions, no keyd or acpid installed and no faststart(or even fastboot in bios), I in fact already deleted windows. I have arch with xfce on one disk and arch with lxqt on another. And do cold start/reset.

EDIT2: Now with this setup(as in above pic) I can wake up with kbd even if I pressed multiple times during sleep. But as mentioned, computer will shut down and then I have to press again to wake it fully.

Last edited by eUser4 (Yesterday 15:01:04)

Offline

#8 Yesterday 20:04:28

seth
Member
Registered: 2012-09-03
Posts: 57,445

Re: Sleep kbd button multi press causing system not to wake up

But as mentioned, computer will shut down and then I have to press again to wake it fully.

What sounds like hibernation.
Disable all power keys (sleep, suspend & poweroff) in the global actions manager and set all power keys to "nothing" in the power manager.
The key should not do anything anymore, right?

Then in the global actions bind XF86Sleep to /powermanager/keysuspend (I guess the "modify" button allows that)
=> Profit?
Alternatively disable the key in the global actions again and set Hibernate key action in the powermanager to "suspend".
=> Profit?

Idk how these things actually tie together, whether those are two UIs controlling the same setting in lxqt (you'll have to report and ask upstream) but worst case, bind the XF86Sleep key to "systemctl suspend" in the global actions menu.

Offline

Board footer

Powered by FluxBB