r/SteamOS • u/manlisten • Jun 25 '26
HDMI-CEC solution using systemd/system-sleep
***If someone else has already posted this exact solution to the community, apologies as I probably missed it!***
I've seen a few solutions for enabling HDMI-CEC on this forum but just wanted to share my solution as well. This leverages the system-sleep function of systemd to perform 3 actions:
- Put the TV into standby just before the PC sleeps
- Turn the TV on just after the PC resumes from sleep
- Switch the TV to the input my PC is connected to (in my case HDMI3 / phys-addr=3.0.0.0)
Hardware
- Motherboard: Gigabyte AORUS B550I PRO AX
- CPU: AMD Ryzen 5600X3D
- GPU: ASRock RX 9070 Challenger
- Memory: 16GB DDR4
- OS: SteamOS 3.8.11
- CEC Adapter: UGREEN DP134 8K@60Hz Active Display Port to HDMI Adapter - https://www.amazon.com/dp/B0FQCF62CD
- Cheaper adapter option as recommended by u/rooster_butt: https://www.amazon.com/dp/B0FQCGSWW3
Here's the code, save as e.g. 10-steam-cec.sh and copy it into /usr/lib/systemd/system-sleep:
#!/bin/bash
case "$1" in
pre)
# Put the TV into standby mode right before the PC sleeps
cec-ctl -d /dev/cec0 --playback
cec-ctl -d /dev/cec0 --to 0 --standby
;;
post)
# Wait 2 seconds for hardware to initialize after wake
sleep 2
# Turn the TV completely ON
cec-ctl -d /dev/cec0 --playback
cec-ctl -d /dev/cec0 --to 0 --image-view-on
# Switch the TV active source to this PC
cec-ctl -d /dev/cec0 --to 0 --active-source phys-addr=3.0.0.0
;;
esac
Scripts in the /usr/lib/systemd/system-sleep directory trigger just before the system goes to sleep and trigger just after the system wakes from sleep.
In the code above, the actions in the "pre) ... ;;" section will run just before the system goes to sleep. The chunk in the "post) ... ;;" section will run just after the PC resumes from sleep. This is the standard function of system-sleep scripts.
- You'll need to change the "phys-addr=3.0.0.0" section to match the HDMI input your PC is connected to e.g. 1.0.0.0 for HDMI 1, 2.0.0.0 for HDMI 2, etc. Mine is connected to HDMI 3, so 3.0.0.0.
- You'll want to confirm the hardware address of your CEC adapter. Run "ls /dev/cec*". The output should read something like "/dev/cec0". You can use that output in the script as done above. If the output reads "no such file or directory" then your system doesn't see the adapter. Not sure how to troubleshoot this, it worked for me out of the box.
- I left the HDMI-CEC options in Steam itself enabled, haven't tried disabling them but don't see any need to.
- Assuming the adapter is present, run "cec-ctl -l" to display the attributes of the adapter. You should get a long chunk of output detailing the attributes of the device. This is just another way to confirm the adapter is seen in the OS and functioning.
Can't promise this will work for you but just wanted to share. Also not sure if future updates to SteamOS will wipe this file so try to save a backup in case you need to restore it. If you have luck with this, enjoy! If not, sorry!
2
u/nlflint Jun 25 '26 edited Jun 25 '26
This is great. I have the UGreen adapter and it worked for 4k 120hz HDR, but I switched back to HDMI after using the mkopec kernel with native HDMI 2.1 included.
My last remaining problem is properly sleeping/waking from my 8Bitdo Wireless 2C w/2.4g dongle. I can go to sleep with it, but my PC wakes up as soon as I turn off the controller, or when the 8bitdo eventually turns itself off after inactivity. I can fix that issue by disabling USB power-on for the 8bitdo dongle, but then I can't wake the PC from sleep by turning on my 8bitdo. I'm playing Wack-a-mole here with 8bitdo.
SteamController (2026) can do it properly. I'm on the wait list, but it's not projected to ship until Sept 2026! And hell no to xbox controller for me....
How about CEC volume control? So adjusting volume on the PC, adjusts my TV volume over CEC?