Comment 4 for bug 1575123

Revision history for this message
mgilroy (michael-gilroy) wrote :

I've the same issue on Ubuntu 16.04 with Intel Skylake. PC connected to the TV, we switch between the computer and TV regularly. Found I was able to get the screen to start using xrandr as suggested above.

To get the screen to start when the TV switched to the PC HDMI/DP

sudo nano /etc/udev/rules.d/95-monitor-hotplug.rules

SUBSYSTEM=="drm", RUN+="/usr/local/bin/fix_tv_state.sh

sudo nano /usr/local/bin/fix_tv_state.sh

Add the following:

###########################################
#!/bin/sh
#Fix TV state when HDMI link is lost.
#By Mario Limonciello <email address hidden>
export XAUTHORITY=/home/username/.Xauthority

OUTPUT="DP2"
BAD_MODE="1280x720"
GOOD_MODE="1920x1080"

for MODE in $BAD_MODE $GOOD_MODE; do
 sleep 2
 DISPLAY=:0 xrandr --output $OUTPUT --mode $MODE
 sleep 2
done

#################################

Note replace username with your username. Change the output to whatever you have e.g. HDMI2

sudo chmod +x /usr/local/bin/fix_tv_state.sh
sudo udevadm control --reload-rules

Change from HDMI back to TV, then back again. Screen comes on after a couple of seconds. Change the sleep times to suit.