For some reason, when asked how to stop mice from waking up a Linux PC, people recommend writing a udev rule and matching by a device ID. No more of this, I found a better way that works with any mouse!
ACTION=="add", ATTRS{bInterfaceClass}="03", ATTRS{bInterfaceProtocol}=="02", ATTR{power/wakeup}="disabled"
I read what is apparently the USB HID specification to learn that HID devices use the bInterfaceProtocol
field to signify if they are a keyboard, a mouse or some other device. The above udev rule matches on that field (apparently udev exposes a lot of interesting stuff about devices, including how much power they want to draw? I wonder if there’s any use for this...) to gather all USB mice in your system.
No more your laptop has to turn on when you jiggle a mouse accidentally.