#!/bin/bash
# Set XAUTHORITY and DISPLAY environment variables
export XAUTHORITY=~volumio/.Xauthority
export DISPLAY=:0
# Run the xset q command to get DPMS information
output=$(xset q)
# Check each line of the output for DPMS status
if [[ $output == *"Monitor is On"* ]]; then
echo "Monitor is ON => Turning OFF"
xset dpms force off
uhubctl -p 1 -a off
elif [[ $output == *"Monitor is Off"* ]]; then
echo "Monitor is OFF => Turning ON!"
xset dpms force on
uhubctl -p 1 -a on
else
echo "Unable to determine monitor status"
fi
Yes, that’s it! This works to wake the USB port and Volumio recognises my DAC straight away.
When I switched from a Pi4 to a Pi5 the original uhubctl command broke. I knew the USB power setup is weird on the Pi5. This version works to wake the USB port and Volumio recognises my DAC straight away.
Ah no, sorry, that’s the old code I copied! The new (Pi5) version is:
#!/bin/bash
# Set XAUTHORITY and DISPLAY environment variables
export XAUTHORITY=~volumio/.Xauthority
export DISPLAY=:0
# Run the xset q command to get DPMS information
output=$(xset q)
# Check each line of the output for DPMS status
if [[ $output == *"Monitor is On"* ]]; then
echo "Monitor is ON => Turning OFF"
xset dpms force off
uhubctl -l 3 -a 0
elif [[ $output == *"Monitor is Off"* ]]; then
echo "Monitor is OFF => Turning ON!"
xset dpms force on
uhubctl -l 3 -a 1
else
echo "Unable to determine monitor status"
fi