Skip to content

Instantly share code, notes, and snippets.

@dkartachov
Last active January 25, 2023 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkartachov/b121615304c84d48ebb3affb588ad751 to your computer and use it in GitHub Desktop.
Save dkartachov/b121615304c84d48ebb3affb588ad751 to your computer and use it in GitHub Desktop.
Disable USB wakeup events on Linux

Disable USB wakeup events on Linux

I'm almost certain these steps will work on most distros but I've only been able to test on Linux Mint 21. Feel free to test on your own distros and add to the list :)

Tested on:

  • Linux Mint 21

Steps

  1. Run lsusb and lsusb -t to identify USB devices and what Bus/Port they are connected to
  2. Let's say you've identified Bus 1 -> Port 13 -> Port 1 in the listed tree, run:
cat /sys/bus/usb/devices/1-13.1/power/wakeup
  1. If you've identified the USB correctly it should most likely print 'enabled'
  2. Open file with your favorite editor, change 'enabled' to 'disabled' and save
  3. Suspend computer and see if it worked. If so, follow next steps to make this change permament
  4. Create and open file using your favorite editor in the following directory (name file whatever you want, I called it 'mouse_disable_wakeup'
sudo nano /lib/systemd/system-sleep/mouse_disable_wakeup
  1. Paste the following script (replace 1-13.1 with your own values)
#!/bin/sh
case "$1" in
    pre)
        echo disabled > /sys/bus/usb/devices/1-13.1/power/wakeup
        ;;
esac
  1. Save file and give it execute permissions:
sudo chmod +x /lib/systemd/system-sleep/mouse_disable_wakeup
  1. Wakeup events should now be disabled even when you reboot PC. Delete the mouse_disable_wakeup script if you want to revert changes

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment