When I put my PC to sleep, I’d like to be able to disable my keyboard and mouse from waking my pc, but allow my bluetooth and xbox controllers to wake the pc.
I have achieved this by creating a bash script that changes the wakeup state of the specific USB devices, the script for that is listed below.
#!/bin/bash
sudo chmod 666 /sys/bus/usb/devices/1-7.2/power/wakeup
sudo echo “disabled” > /sys/bus/usb/devices/1-7.2/power/wakeup #disables keyboard usb wakeup
sudo chmod 644 /sys/bus/usb/devices/1-7.2/power/wakeup
sudo chmod 666 /sys/bus/usb/devices/1-13.4/power/wakeup
sudo echo “disabled” > /sys/bus/usb/devices/1-13.4/power/wakeup #disables mouse usb wakeup
sudo chmod 644 /sys/bus/usb/devices/1-13.4/power/wakeup
sudo chmod 666 /sys/bus/usb/devices/1-13.1/power/wakeup
sudo echo “enabled” > /sys/bus/usb/devices/1-13.1/power/wakeup #enables bluetooth usb wakeup
sudo chmod 644 /sys/bus/usb/devices/1-13.1/power/wakeup
I have attempted to create a service that runs this script on startup butI am unable to make it start when booting or rebooting my pc. If I run the script and then only put my pc to sleep the wakeup states stay as I’d like them, however when rebooting the script must be manually run again.
Any help would be appreciated.