[mythtv-users] power off and on frontend only with remote

Leighton Brough brough at baremetalsoft.com
Mon Oct 16 03:26:33 UTC 2006


> I spent a long night last night making this work for my setup.  I have 
> to say its pretty amazing now that I have it working though. 
I've also got the MCE USB v2 remote waking up my system for 
suspend-to-RAM now, as of kernel 2.6.18. It was possible with 2.6.17, 
but was much more fiddly to configure.
>
> For Suspending:
> I ended up setting it up so that I use the Ubuntu interface 
> (/etc/default/acpi-support) for configuring STR. 
> 1) I stop both lirc and gdm services. 
I also find it's necessary to stop lircd before suspend and restart it 
after resume.
> 2) I remove all lirc modules and my nvidia modules. 
I find I don't need to remove and reload the lirc_mceusb2 module. I'm 
using a pretty up-to-date version, I can't tell you what off the top of 
my head.

I also find it's not necessary to unload the NVIDIA module, if you use a 
fairly recent version. I'm using 8774 (the latest), but I've seen in 
their release notes that power management support has been improving for 
the last few releases. The big advantage to not stopping the nvidia 
module is that you don't have to stop and restart X, which is quite slow 
to startup.

I have also found that I need to unload the USB2 module (ehci_hcd), or 
the system immediately wakes up on suspend.
> 3) I disabled vbetool save and post usage.
I've found that with the NVIDIA drivers, you do need to use vbetool to 
restore a text mode console state, but if you're using a framebuffer 
console, the driver handles everything gracefully.
>
> Now, when the machine is running I set up irexec to launch a shell 
> script that I wrote when pressing power, 
> /usr/local/bin/turnoff_computer.sh.
> This will send a signal to turn off my reciever and switch it to the 
> other commonly used input when I'm not using the computer.  It also 
> executes /etc/acpi/sleep.sh. (The Ubuntu sleep script).  My LCD TV 
> goes into a low power mode once the computer suspends.
>
> To make the computer wake back up, all I had to do was change a jumper 
> on the motherboard to provide +5VSB voltage.  I checked the power 
> supply, and it supplied 2A which should have been plenty enough.
>
> Now, when I press power on the remote, the computer wakes up, and 
> automatically logs into gdm as gdm starts.  The gdm session I have 
> powers back on the receiver, and starts myth back up.
As you're running a FE only box here, you should be able to suspend and 
resume without stopping and re-starting mythfrontend if you can avoid 
unloading the nvidia module, and therefore stopping X. It will be a 
_lot_ quicker to resume that way.

I've got a combine BE/FE box, so things are a bit more complex for me. 
My DVB drivers (bttv, Twinhan) don't cope with the transition to and 
from S3, so I do have to unload these. I had previously assumed that 
this meant I would need to stop mythbackend. Reading through the source 
recently, I noticed the "Open DVB on demand" option in the recording 
options settings of the tuner card setup. Setting this for my tuners 
means that I can unload the DVB modules, without stopping the backend. 
This in turn means that I don't need to stop the frontend either.

I've now got it working so that mythfrontend and mythbackend aren't 
stopped when I suspend to RAM and resume. The result is that my mythbox 
starts up in just a few seconds, which to my mind is pretty much ideal 
for a living room appliance.

The config to get this going took me a couple of days of careful 
planning and a lot of reading of the source. I can post more details if 
anyone's interested - this post is long enough already.

I also needed to make a one line change to the mythbackend source so it 
could tolerate a transition to S3 and resume, as it assumes it's stopped 
and restarted when it performs it's shutdown action. I'll put a patch 
for this into Trac, when I find the time to work out what's involved in 
this, as I don't think my change will break any existing behaviours.
>
> Everything works nearly perfectly now, and when not watching TV - my 
> living room is silent :)
"Nearly perfect" is exactly where I'm up to now as well. I find I get 
occasional (hard lockup) crashes on resume from S3, and the playback of 
some recordings stutter after resume too. But it is probably only a 
matter of time before I get to the bottom of these since I've only had 
it working like this for a few days.

Leighton


More information about the mythtv-users mailing list