Adding control over which devices can and can't wake the computer

After 19.10 broke suspend on my HTPC I remembered that Windows lets you choose what devices can or can't trigger wakeups.

I don't remember if I had to fix this by hand originally, but looking around the Web quickly just now it seems to involve an awful lot of screwing around with lsusb/lspci etc, then creating an etc/init.d script with user-friendly things like "echo disabled > /sys/bus/usb/devices/3-3/power/wakeup" in it. (Which may well be what I did on the HTPC at some point, and systemd has decided to simply not bother running it in this newer version).

Or to put that another way: dealing with problems like this is a steaming pile of misery on Linux. It seems to me that something in the Power Management applet that listed USB devices with associated checkboxes for "Allow this to etc" would be a huge improvement, and potentially not too hard to do?

The "big" problem I can foresee with it is that if you e.g. end up swapping the mouse and keyboard connectors, you'd end up with the mouse performing wakeups and the keyboard not, because the association is via USB port rather than device name.
That would obviously be a bit janky, but the "ideal" fix for it, i.e. storing the device names and updating the /sys pieces properly by referencing those names back to the USB/PCI devices, does complicate things a fair bit. Is this the sort of thing that mate-settings-daemon caters to?

Even in that most basic form though, it would still be a HUGE improvement over the Absolute Nothing that we have currently. Potentially needing to re-run the applet if the connections change is a very small price to pay, and not something most users would ever need to do after the initial setup. (In fact, for desktops it's more likely that they'd need it when replacing a mouse, in which case name association wouldn't actually improve things at all).

Any thoughts? Is this something that would be reasonably viable within MATE?

The only thought is that I have never used that possibility nor in Windows nor in Linux, hence I have no idea, why on the earth people might want that :wink:

Because if you don't have that functionality, it can be either difficult or outright impossible to actually suspend the machine. Suspending an HTPC with the mouse is the most trivial example, and it should be obvious how that simply cannot work without this. :slight_smile:
I've also had external USB storage (mechanical ones) block suspend indefinitely unless physically unplugged (or "Ejected", which amounts to the same thing since it means they have to be re-plugged to work next time) regardless of whether they'd been flushed or not, or had even been idle for so long that they'd gone into their own suspend mode.

Even on my desktop, where suspend is done from the keyboard, without disabling mouse wakeup it takes multiple tries to actually get suspend to stick. IDK if that's because the mouse is chatty or if it's moving 0.001mm because of cable drag, but either way, it's a pain in the ass.

Flaky BIOSes, USB wifi adaptors, and the thousands of other Weird Things that can be plugged into those ports, makes allowing wakeups from every USB device pretty much guaranteed to break suspend for a huge number of people.

Ok. Thank you for clarifying. I was somewhat misled by the topic which did not mention 'control' and that sounded like if you wanted just to enable wakeups. :wink:

That's a good point, thanks - I've updated the title to clarify. :slight_smile: