Set up display with hook after suspend to ram

Hi all,

I’m running OS 11.2 with KDE4. Unfortunately (?) I have to use the fglrx driver, as I could not get XBMC working with radeon or radeonhd.

Well, fglrx works OK, however it does an automatic underscan on my LCD TV (connected via HDMI). So I reset this underscan to get rid of the black box around my desktop by issuing four commands in /etc/X11/xinit/xinitrc:

aticonfig --set-dispattrib=tmds2i,positionX:0
aticonfig --set-dispattrib=tmds2i,positionY:0
aticonfig --set-dispattrib=tmds2i,sizeX:1920
aticonfig --set-dispattrib=tmds2i,sizeY:1080

Solved that problem, on to the next:
Obviously, xinitrc will not be called after doing a suspend2ram, but fglrx decided to get me back to underscan. So I tried to set up a hook:

#!/bin/bash
case $1 in
    hibernate)
        # Suspend to disk
        ;;
    suspend)
        # Suspend to RAM
        ;;
    thaw)
        # Wake from disk
        ;;
    resume)
        aticonfig --set-dispattrib=tmds2i,positionX:0
        aticonfig --set-dispattrib=tmds2i,positionY:0
        aticonfig --set-dispattrib=tmds2i,sizeX:1920
        aticonfig --set-dispattrib=tmds2i,sizeY:1080
        ;;
    *)  echo "Not supported call..."
        ;;
esac

Called the hook “66correctScreenResolution”, placed it in /etc/pm/sleep.d and ran a “chmod +x” on it.

Sadly, it’s not working - /var/log/pm-suspend.log says:

===== 2010-02-09 00:12:45.552563552 running hook: /etc/pm/sleep.d/66correctScreenResolution =====
 Try to Set positionX adjust of monitor tmds2i value : 0 failed.
 It may not supported by monitor or the value beyond the range.
 Try to Set positionY adjust of monitor tmds2i value : 0 failed.
 It may not supported by monitor or the value beyond the range.
 Try to Set sizeX adjust of monitor tmds2i value : 1920 failed.
 It may not supported by monitor or the value beyond the range.
 Try to Set sizeY adjust of monitor tmds2i value : 1080 failed.
 It may not supported by monitor or the value beyond the range.

I get the exact same error messages, if I try to run the four aticonfig commands with “sudo -s” - however, it works, if I run them as “su”.

So finally coming to the question: Is a hook running with sudo privileges? Can I get it to run as “real” “su” ? Any other ideas (short of creating a hook that’s logging me off, then on again?)

Cheers

Martin

P.S. I hope “Hardware” was the correct forum to post this question…

You may need to unload the driver on suspend, reload it on resume. But that’s merely a suggestion.

Hi Knurpht,

thanks for the suggestion, I’ll try it as soon as I get to my machine again (which might be a week…) - however, I don’t believe it will work.
The graphics do work after s2ram and resume, it’s just this “automatic underscan” issue.

Maybe someone else has an idea for doing this via a hook?

Cheers

Martin

Unfortunately, unloading and re-loading fglrx module does not help.
So the question still remains: can I run a hook either as normal user (as “me”) instead of with sudo priviliges? A normal user can use the aticonfig to set up the screen, but a hook can not.
Any ideas anyone?

Cheers

Martin