armbian-build/packages/bsp/rockchip/hdmi-hotplug
Tonymac32 6ddb6732b0 Rockchip HDMI Hotplug
Script and udev rule.  Only applies to mainline.  Not board specific per se, but may not be needed universally, so applied to specific board.
2017-09-29 00:14:04 -04:00

15 lines
370 B
Bash

#!/usr/bin/env bash
USER="$(who | grep :0\) | cut -f 1 -d ' ')"
export XAUTHORITY=/home/$USER/.Xauthority
export DISPLAY=:0
HDMI_STATUS="$(cat /sys/class/drm/card0-HDMI-A-1/status)"
# Check to see if HDMI connected or not and toggle if change
if [ "${HDMI_STATUS}" = connected ]; then
xrandr
xrandr --output HDMI-1 --auto
else
xrandr --output HDMI-1 --off
fi
exit 0