Controllers Don’t Wake Linux from Sleep
Putting together a gaming PC with Bazzite makes a home theatre PC pretty console-like, but it lacks a big advantage consoles have: waking the system from sleep and turning one the TV.
The latter requires an HDMI CEC device as a go-between, but the controller waking the system from sleep is possible. It takes some custom scripts to do it. If you aren’t very comfortable in the Terminal, you might want to stick with a mouse or keybard.
These scripts are for informational purposes only. Only try if you are comfortable working with Linux scripts and the Terminal. I am not responsible if you bork your system! Use at your own risk.
Step-by-Step to Enable Wake from USB Device
Controllers don’t have the ability to wake Linux from sleep the way a keyboard does. The work around is to set up a specific USB port to wake the system when there is activity on the port.
The one gatcha with this approach is when you set the system to sleep with the controller, it will send a signal when it shuts off, waking the system back up. A way to deal with this is to just let the system go to sleep on it’s own and only use the controller to wake the system. I have an alternative script at the end of this post to kinda get around this.
Find Your USB Bus
Open the Terminal and run:
|
|
Identify the line corresponding to your controller. For example mine is this:
|
|
the Bus
number is the physical port it is connected to. This doesn’t change.
On my setup, there is a file here /sys/bus/usb/devices/usb3/power/wakeup
. Your’s will likely be different.
usb3
is the important part. This wakeup variable controls Bus 003
.
It is set to disabled
. We want to change that so any activity on that USB port will wake the computer.
Persistent Setup via Udev Rule
Create or edit the file:
|
|
And add this code. (Replace usb3
with your selected port above.):
|
|
Save the changes to the file.
Apply and Your Changes
After saving run these terminal commads:
|
|
Then suspend your system and test waking with the controller again.
Verify the Changes
You can confirm the rule is applied automatically on boot or after plugging in the device:
|
|
Should return:
|
|
Optional: Delay Suspend by 20 Seconds
To give the controller a little bit of time to be shut off before suspend, you can try this script that delays suspend. It works but I didn’t like the flow and just let my system suspend after an idle time set in the Steam OS settings instead.
I would only try this if you are comfortable working with scripots in the Terminal.
Create a Dealy Script
|
|
Edit the file:
|
|
Make it executable:
|
|
Create a Systemd Service
|
|
Add this to the file and save:
|
|
Enable It:
|
|
You can verify each suspend event with:
|
|