mycnc:hdmi_event_handler_for_sbc_tinkerboard
This is an old revision of the document!
HDMI event handler for SBC Tinkerboard
We use ARMBIAN Linux for Tinkerboards. We found HDMI events are not handled by default in Armbian. As a result monitor might go to “Power Safe” mode after Power On, HDMI cable connected or resolution changed.
We added HDMI event handler to solve this problem.
1. Script hdmi-toggle to handle HDMI is placed in /usr/local/bin folder
- hdmi-toggle
!/usr/bin/env bash USER="$(who | grep :0\) | cut -f 1 -d ' ')" echo USER ${USER} sudo chown operator:operator /home/operator/hdmi-toggle.log echo HDMI-TOGGLE >>/home/operator/hdmi-toggle.log export XAUTHORITY=/home/$USER/.Xauthority export DISPLAY=:0 ########### Settings ########### # Use 'xrandr' to find these #DP="DP-1" #VGA="VGA-1" HDMI="HDMI-1" #INTERNAL_DISPLAY="LVDS-1" # Check /sys/class/drm for the exact location #DP_STATUS="$(cat /sys/class/drm/card0-DP-1/status)" #VGA_STATUS="$(cat /sys/class/drm/card0-VGA-1/status)" HDMI_STATUS="$(cat /sys/class/drm/card0-HDMI-A-1/status)" echo ${HDMI_STATUS} >>/home/operator/hdmi-toggle.log # Do no change! EXTERNAL_DISPLAY="" # Check to see if the external display is connected if [ "${DP_STATUS}" = connected ]; then EXTERNAL_DISPLAY=$DP fi if [ "${VGA_STATUS}" = connected ]; then EXTERNAL_DISPLAY=$VGA fi if [ "${HDMI_STATUS}" = connected ]; then EXTERNAL_DISPLAY=$HDMI fi # The external display is connected if [ "$EXTERNAL_DISPLAY" != "" ]; then # Set the display settings xrandr xrandr --output HDMI-1 --auto # xrandr -s 1368x768 else # Restore to single display xrandr --output HDMI-1 --off fi exit 0
1. UDEV rule should be setup to catch events from HDMI. File “99-hdmi.rules” is added to “/etc/udev/rules.d” folder. HDMI rules are
- 99-hdmi.rules
SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi-toggle"
mycnc/hdmi_event_handler_for_sbc_tinkerboard.1521838595.txt.gz · Last modified: 2018/03/23 16:56 by skirillov