[mythtv-users] 'xrandr --auto' on resume

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Oct 31 00:35:48 UTC 2017

On Mon, 30 Oct 2017 15:10:49 +0000, you wrote:

>After some changes to my main FE moving between IR and bluetooth control, i've had to move from wake-on-IR (poweroff) to resume-on-usb (s3 sleep).
>along with this, i've found i need to run 'xrandr --auto' for the NUC to redetect the TV/AVR. i assume something todo with EDID data.
>unfortuntately i've not had much luck in getting this reliable. afaik it's in the correct pm-utils script dir with execute perms (/usr/lib/pm-utils/sleep.d/)
>Sometimes the display resumes, sometimes not. when it fails, SSH into the FE and running the script manually will always bring the display back. I've done a simple 'sleep 5' in the script and that doesnt makes things better.
>does anyone have an idea for solution, or a better way to handle resuming?
>if it helps any, cabling is NUC > AVR > TV with HDMI to connect between them.

It seems that xrandr only works if the X session it is trying to
control is the same user as xrandr is running from.  So if you ssh in
as the same user as the desktop is running under, it works (but you
will have to specify the desktop to connect to).  So in my case, if I
ssh to my MythTV box as root and run xrandr, it does not work.  But if
I ssh as my mythfrontend user (stephen), this command does work:

xrandr -d :0.0

I have never delved into how the /usr/lib/pm-utils/sleep.d/ scripts
work, but my guess would be that they are run from root, so xrandr
will not work from there.  From a root ssh, this works:

su -c "xrandr -d :0.0" stephen

So I suspect that is what you will need to do from a
/usr/lib/pm-utils/sleep.d/ script.

More information about the mythtv-users mailing list