View Single Post
Old 06-21-11, 08:54 AM   #5
ScreamerX
Registered User
 
Join Date: Oct 2010
Posts: 2
Default Re: HP EliteBook 8440p (NVIDIA NVS 3100M) fails to restore screen after DPMS suspend

I've written a nasty workaround for this problem.
This script monitors /var/log/Xorg.0.log for changes.
If an error about "DisplayPort link training failed" gets logged,
it calls "xset dpms force on".

The problem occurs, because the first 3 attempts to train the DisplayPort always fail.
If you move the mouse or call "xset dpms force on" it will do 3 attempts to train the DisplayPort.
After the 4th or 5th attempt it will work.

This observation can easily be reproduced over ssh:
Code:
xset dpms force off
The first attempt to resume from suspend/off always fails and it will log an error to /var/log/Xorg.0.log
Code:
xset dpms force on
The second attempt of this command should work as expected.


Code:
#!/bin/sh

# nvidia_dpms_fix.sh
# 2011-06-12
# by Gernot WALZL

# nasty workaround for nvidia drivers to resume from dpms off/suspend

export DISPLAY=:0

getXauthority () {
  export XAUTHORITY=$(ps -C X -f | grep "$DISPLAY" \
    | sed -n 's/.* -auth \([^ ]*\).*/\1/p')
}

handle_line () {
  if echo "$1" | grep -e "(EE) NVIDIA.* DisplayPort link training failed" \
      > /dev/null; then
    getXauthority
    xset dpms force on
  fi
}

tail --follow=name /var/log/Xorg.0.log --retry --lines=1 2> /dev/null \
  | while read line; do
    handle_line "$line"
  done
ScreamerX is offline   Reply With Quote