<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 8, 2017 at 4:43 AM, Tim Draper <span dir="ltr"><<a href="mailto:veehexx@zoho.com" target="_blank">veehexx@zoho.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
<br>
 ---- On Tue, 31 Oct 2017 00:35:48 +0000 Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote ----<br>
<div><div class="gmail-h5"> > On Mon, 30 Oct 2017 15:10:49 +0000, you wrote:<br>
 ><br>
 > >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).<br>
 > ><br>
 > >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.<br>
 > >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/)<br>
 > ><br>
 > >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.<br>
 > ><br>
 > >does anyone have an idea for solution, or a better way to handle resuming?<br>
 > >if it helps any, cabling is NUC > AVR > TV with HDMI to connect between them.<br>
 ><br>
 > It seems that xrandr only works if the X session it is trying to<br>
 > control is the same user as xrandr is running from.  So if you ssh in<br>
 > as the same user as the desktop is running under, it works (but you<br>
 > will have to specify the desktop to connect to).  So in my case, if I<br>
 > ssh to my MythTV box as root and run xrandr, it does not work.  But if<br>
 > I ssh as my mythfrontend user (stephen), this command does work:<br>
 ><br>
 > xrandr -d :0.0<br>
 ><br>
 > I have never delved into how the /usr/lib/pm-utils/sleep.d/ scripts<br>
 > work, but my guess would be that they are run from root, so xrandr<br>
 > will not work from there.  From a root ssh, this works:<br>
 ><br>
 > su -c "xrandr -d :0.0" stephen<br>
 ><br>
 > So I suspect that is what you will need to do from a<br>
 > /usr/lib/pm-utils/sleep.d/ script.<br>
 > ______________________________<wbr>_________________<br>
 > mythtv-users mailing list<br>
 > <a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
 > <a href="http://lists.mythtv.org/mailman/listinfo/mythtv-users" rel="noreferrer" target="_blank">http://lists.mythtv.org/<wbr>mailman/listinfo/mythtv-users</a><br>
 > <a href="http://wiki.mythtv.org/Mailing_List_etiquette" rel="noreferrer" target="_blank">http://wiki.mythtv.org/<wbr>Mailing_List_etiquette</a><br>
 > MythTV Forums: <a href="https://forum.mythtv.org" rel="noreferrer" target="_blank">https://forum.mythtv.org</a><br>
 ><br>
<br>
</div></div>interesting info on the 'xrandr -d :0.0'.<br>
i've always used the 'export DISPLAY=:0' method prior to interacting with xrandr.<br>
<br>
your right on pmutils requiring root.<br>
<br>
seems my problem was a number of things.<br>
1) have to exit mythtv playback before sleeping the FE. no problem, i just configured my harmony remote to use the MENU jumppoint, wait 1 second, then send sleep command. If i dont exit livetv, something gets upset and end up with a frozen screen on resume. somewhat expected results  for a nicer experience on resume using a jumppoint is the simpliest way to handle this<br>
2) re-ordered my harmony remote startup order. TV on (tv the goes through warmup locking out further commands), AVR on & source select, 1sec delay, TV source select, and finally bluetooth wakeup command for NUC.<br>
3) the main issue i think was that i didnt have 'sleep' defined on my harmony remote for the power-off process, so the NUC never actually entered S3 sleep, thus pmutils scripts were never called when i thought i was resuming.<br>
<br>
sorry it's taken so long to get back - been a week of life getting in the way and only just found the time this morning to look at it.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">I recently got a celeron NUC6CAYH and had to do some fiddling to get the HDMI to set correctly on resume.  My issue was the dislpay switching to 4k mode so I triggered xrandr to revert to 1920 while the tv turns on.  I ended up with the following script triggering under pmutils.  When run from pmutils the script would give an error about not connecting to DISPLAY until I added the XAUTHORITY line.  The pause 5 catches when the tv needs more time to wake up from a longer inactivity.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">My NUC is waking from IR because it will actually power on from full power loss with an MCE wake up command.  <br></div><div class="gmail_extra"><br></div><div class="gmail_extra"> <br><br>#!/bin/sh<br>#Runs on resume<br>export XAUTHORITY=/home/<X user>/.Xauthority<br>export DISPLAY=:0.0<br>xrandr --display :0.0 -s 1920x1080 -r 60<br>sleep 5; xrandr --display :0.0 -s 1920x1080 -r 60</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">David <br></div></div>