Disabling unwanted wakeup from hibernation

If none of the more specific forums is the right place to ask

Disabling unwanted wakeup from hibernation

Postby Caitlin » 2018-10-13 11:11

(Question 1:) When I hibernate I have to very careful not to touch the mouse or the keyboard -- or my computer will wake up when I don't want it to, and then I have to hibernate it again. I want it to wake up from hibernation with the power button only.

Here is the (original) output from #cat /proc/acpi/wakeup:

Code: Select all
Device   S-state     Status   Sysfs node
PCI0             S5   *disabled  no-bus:pci0000:00
USB0     S3   *enabled   pci:0000:00:12.0
USB1     S3   *enabled   pci:0000:00:12.2
USB2     S3   *enabled   pci:0000:00:13.0
USB3     S3   *enabled   pci:0000:00:13.2
USB4     S3   *enabled   pci:0000:00:16.0
USB5     S3   *enabled   pci:0000:00:16.2
USB6     S3   *enabled   pci:0000:00:14.5
SBAZ     S4   *disabled
PEX0     S5   *disabled  pci:0000:00:15.0
PEX1     S5   *disabled  pci:0000:00:15.1
PEX2     S5   *disabled
PEX3     S5   *disabled
P2P            S5   *disabled  pci:0000:00:14.4
PCE2     S4   *disabled  pci:0000:00:02.0
PCE3     S4   *disabled
PCE4     S4   *disabled
PCE5     S4   *disabled
PCE6     S4   *disabled
PCE7     S4   *disabled
PCE9     S4   *disabled  pci:0000:00:09.0
PCEA     S4   *disabled  pci:0000:00:0a.0
PCEB     S4   *disabled
PCEC     S4   *disabled
PS2M     S5   *disabled
PS2K     S5   *disabled

So I entered the following command to turn off USB0 through USB6:

Code: Select all
echo USB0 > /proc/acpi/wakeup; echo USB1 > /proc/acpi/wakeup; echo USB2 > /proc/acpi/wakeup; echo USB3 > /proc/acpi/wakeup; echo USB4 > /proc/acpi/wakeup; echo USB5 > /proc/acpi/wakeup; echo USB6 > /proc/acpi/wakeup

Then I entered the cat command again and the output was the same as before, but now they were ALL disabled, as I intended.

Next, I hibernated. Once that was done shaking and clicking the mouse did nothing (as desired) but pressing the space bar woke the machine up.

The mouse has a PS/2 type connector coupled with an adapter that plugs into a processor box USB port. The keyboard is plugged directly into a USB port.

The computer is a generic tower case running Debian 9.2 with the MATE desktop.

(Question 2:) When researching this on the internet, (https://wiki.archlinux.org/index.php/Po ... _hibernate, and yes, I know Arch is not Debian) it said you can toggle the wakeup options (using echo, as shown above) but at the end of the next boot they're reset to their defaults; so I wrote a script to re-disable them on every boot:

Code: Select all
[Unit]
Description=Disable USB wakeup triggers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo USB0 > /proc/acpi/wakeup; echo USB1 > /proc/acpi/wakeup; echo USB2 > /proc/acpi/wakeup; echo USB3 > /proc/acpi/wakeup; echo USB4 > /proc/acpi/wakeup; echo USB5 > /proc/acpi/wakeup; echo USB6 > /proc/acpi/wakeup"
ExecStop=/bin/sh -c "echo USB0 > /proc/acpi/wakeup; echo USB1 > /proc/acpi/wakeup; echo USB2 > /proc/acpi/wakeup; echo USB3 > /proc/acpi/wakeup; echo USB4 > /proc/acpi/wakeup; echo USB5 > /proc/acpi/wakeup; echo USB6 > /proc/acpi/wakeup"
RemainAfterExit=yes;

[Install]
WantedBy=multi-user.target

To activate the running of this script I was supposed to enter the following commands (but I haven't done so yet):

Code: Select all
# systemctl enable disable-USB-wakeup.service
# systemctl start disable-USB-wakeup.service

However on subsequent boots the options are all disabled. Does Stretch remember the changes now or is my script getting run even without being enabled and started?

I am open to suggestion.

Caitlin
Caitlin
 
Posts: 265
Joined: 2012-05-24 07:32

Re: Disabling unwanted wakeup from hibernation

Postby bw123 » 2018-10-13 13:40

If the service file is enabled when you shutdown, it's enabled when you reboot. If you put it in /etc/systemd/system or somewhere like that, it's enabled, you can check it with
Code: Select all
$ systemctl status disable-USB-wakeup.service

to confirm it is enabled.
User avatar
bw123
 
Posts: 3517
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Disabling unwanted wakeup from hibernation

Postby Caitlin » 2018-10-14 07:43

bw123 wrote:If the service file is enabled when you shutdown, it's enabled when you reboot. If you put it in /etc/systemd/system or somewhere like that, it's enabled, you can check it with
Code: Select all
$ systemctl status disable-USB-wakeup.service

to confirm it is enabled.

I just checked and the service was NOT enabled.

But my question was whether the USB's were enabled for wakeup, not whether the service was enabled. The USB's went back to enabled (I wanted disabled).

Caitlin
Caitlin
 
Posts: 265
Joined: 2012-05-24 07:32

Re: Disabling unwanted wakeup from hibernation

Postby bw123 » 2018-10-14 09:12

/proc is created at boot time, It's a pseudofs, (all of it?) exists in ram so the settings disappear on shutdown.

On my system USB1-4 are all enabled by default, but I'm not sure that would be true on every system.

Might be better to think of your service as toggle-USB-wakeup, it doesn't disable anything, it toggles the state.

Sorry I didn't understand what is question 1?
User avatar
bw123
 
Posts: 3517
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Disabling unwanted wakeup from hibernation

Postby debiman » 2018-10-14 13:42

Caitlin wrote:When I hibernate I have to very careful not to touch the mouse or the keyboard -- or my computer will wake up when I don't want it to, and then I have to hibernate it again.
is this happening when you hibernate by command, or when it hibernates automatically because it's time?
for the latter i'd say it's expected behaviour.

bw123 wrote:If the service file is enabled when you shutdown, it's enabled when you reboot. If you put it in /etc/systemd/system or somewhere like that, it's enabled, you can check it with
Code: Select all
$ systemctl status disable-USB-wakeup.service

to confirm it is enabled.

to clarify:
"enabled" does NOT mean that the service is actually running now. can be, but doesn't have to.
enabled means that it will be started at the next reboot.
to check for that specifically, you can run
Code: Select all
systemctl is-enabled disable-USB-wakeup.service
User avatar
debiman
 
Posts: 3015
Joined: 2013-03-12 07:18


Return to General Questions

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable