You are not logged in.

#1 2017-07-02 08:32:18

alex.theoto
Member
From: Athens Greece
Registered: 2014-11-30
Posts: 307

[SOLVED] Wakeup from suspend with specific key.

Hello.
Is there a way to wakeup my system from suspend by pressing a specific key and not any key on my usb keyboard?
To be more specific, the keyboard doesn't have any sleep or power button and I suspend my system with

systemctl suspend

Last edited by alex.theoto (2017-07-03 17:22:07)

Offline

#2 2017-07-02 09:06:34

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [SOLVED] Wakeup from suspend with specific key.

Short story: no
Long story: Hack the firmware of the keyboard to detect a suspend and only send an event to the computer if you press a specific key. (this is afaik how mediacenter remotes does it), or hack the firmware of the motherboard.

Edit: could also solve it with a hardware mitm device.

Last edited by Mr.Elendig (2017-07-02 09:07:10)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2017-07-02 12:11:02

seth
Member
Registered: 2012-09-03
Posts: 49,986

Re: [SOLVED] Wakeup from suspend with specific key.

This sounds like an xy problem. Why do you want to limit the feature to a specific key itfp?

Offline

#4 2017-07-02 15:04:31

alex.theoto
Member
From: Athens Greece
Registered: 2014-11-30
Posts: 307

Re: [SOLVED] Wakeup from suspend with specific key.

I want to use a specific key because my kids (cats) accidentally press one key and the system wakeup without knowing at random times.
Actually, the computer is a laptop but the only functional part is the motherboard which is screwed on a piece of wood.
Power button is not easy to press and the keyboard and mouse are wired on usb.

Offline

#5 2017-07-02 15:20:26

seth
Member
Registered: 2012-09-03
Posts: 49,986

Re: [SOLVED] Wakeup from suspend with specific key.

What if you deactivate keyboard and mouse altogether and eg. open a second or third hub (if present) to resume by plugging eg. a usb key (no, it will react to any key and even another keyboard being plugged ;-)
See  /proc/acpi/wakeup

Offline

#6 2017-07-03 16:47:31

alex.theoto
Member
From: Athens Greece
Registered: 2014-11-30
Posts: 307

Re: [SOLVED] Wakeup from suspend with specific key.

 cat /proc/acpi/wakeup 
Device  S-state   Status   Sysfs node
AZAL      S3    *disabled  pci:0000:00:1b.0
P0P1      S4    *disabled  pci:0000:00:1e.0
EHC1      S3    *enabled  pci:0000:00:1d.0
USB1      S3    *disabled
USB2      S3    *disabled
USB3      S3    *disabled
USB4      S3    *disabled
USB5      S3    *disabled
USB6      S3    *disabled
USB7      S3    *disabled
RP01      S4    *disabled  pci:0000:00:1c.0
PEG5      S4    *disabled

I found this thread and I decided to wake up my system only from power button.
I created thread's bash script at /usr/lib/systemd/scripts/  chmod into executable but when I reboot, EHC1 is still enabled. If I run the script from terminal, EHC1 changes into disabled.
Do I have to enable something on systemd to activate this script?

Thank you.

Offline

#7 2017-07-03 16:59:30

seth
Member
Registered: 2012-09-03
Posts: 49,986

Re: [SOLVED] Wakeup from suspend with specific key.

Those scripts are not magically executed (when?) but the location is usable to services rediding in /usr/lib/systemd/system (you could also put them into /usr/bin, but then they'd end up in a path)
=> you'll have to eg. add a oneshot service that calls your "script" (or just put the call there - "ExecStart=/bin/sh -c '...'" is a fairly common pattern) and either enable or "want" it.

Offline

#8 2017-07-03 17:21:47

alex.theoto
Member
From: Athens Greece
Registered: 2014-11-30
Posts: 307

Re: [SOLVED] Wakeup from suspend with specific key.

Thank you very much.
I created a unit described on my previous link and everything works fine.
Problem solved.

Offline

Board footer

Powered by FluxBB