You are not logged in.

#1 2020-02-19 02:03:46

Registered: 2011-02-27
Posts: 221

Disable ACPI wakeup from PS/2 keyboard (without grep)

By default, my laptop will wake up from standby when a key on the keyboard is pressed.  I'd like to disable this.
The laptop keyboard evidently appears to the OS as an old-style PS/2 keyboard, so running the following bash script works:

grep -q 'PS2K.*enabled' < /proc/acpi/wakeup && echo PS2K > /proc/acpi/wakeup

I'm just curious if there is a "cleaner" way to do this -- some method not using bash+grep.
My brief attempt at a udev rule didn't work, since PS/2 devices don't seem to have the same "power/wakeup" attribute as USB devices.
I also checked for a setting in the BIOS and didn't find anything.

Any ideas?


#2 2020-02-19 05:21:24

Registered: 2015-03-09
Posts: 794

Re: Disable ACPI wakeup from PS/2 keyboard (without grep)

I didn't find anything to tweak in /sys, so I'm thinking /proc/acpi/wakeup is really the only way. I fully embraced what you are trying to avoid and use this bash code here:

while read -r device _ status _; do
    [[ $device == +([EX]HC*|USB*|PS2*) && $status == "*enabled" ]] &&
        echo $device > /proc/acpi/wakeup
done < /proc/acpi/wakeup

This looks for XHC, EHC, USB, PS2 names. The EHC name is needed on an old system I have here, the XHC and PS2 come from my newest system, the USB is from a laptop. I stuff this code directly into the "ExecStart=" line of a system service to apply it at boot:

Description=Disable USB controllers in /proc/acpi/wakeup

ExecStart=bash -c '\
    while read -r device _ status _; do \
        [[ $device == +([EX]HC*|USB*|PS2*) && $status == "*enabled" ]] && \
            echo $device > /proc/acpi/wakeup; \
    done < /proc/acpi/wakeup; \
    true \



Board footer

Powered by FluxBB