![]() |
![]() OCAU News - Wiki - PC Database - QuickLinks - Pix - Sponsors |
|
|||||||
|
Sign up for a free OCAU account and this ad will go away! Search our forums with Google: |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Mar 2007
Posts: 1,413
|
Howdy all.
I spent awhile doing this. Drove me nearly insane, but i found a solution. It's very nice, i hit the power button on my remote and the myth frontend sleeps. Hit it again when it's sleeping and it wakes back up again. Makes the frontend only machine alot more usable for the non-techies in our house .Steps it took. 1) Enable suspend-to-ram or suspend-to-disk. Basically here we are just testing if your motherboard can do this. Some can't, some don't resume etc, best to figure it out now, because if your board can't do it, there's not much point in reading the rest of it. I ended up using pm-suspend to put the machine to sleep. Basically run Code:
sudo pm-suspend Your machine should go into sleep, and you'll probably have to hit the power button to bring it back (or possibly bang on a keyboard/mouse). If all goes well it should resume back into where it was before. 2) Allow the myth user to run pm-suspend without a password Like all shutdown things, pm-suspend needs to be run by root (or via sudo). This isn't great for your mythtv frontend, typing in a password would be a big hassle!. What we will do, is use visudo to allow the mythtv user to run sudo pm-suspend without being bugged for a password. In a terminal Code:
sudo visudo Go to the bottom of this file and enter at the very bottom (i think bottom has higher priorites) Code:
mythtvuser ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend Code:
sudo pm-suspend 3) Enable the remote to wake-up from sleep. This allows you to use the remote to wakeup the machine. First enter in a terminal Code:
cat /proc/acpi/wakeup Edit /etc/rc.local and add Code:
sudo sh -c "echo USB0 > /proc/acpi/wakeup" sudo sh -c "echo USB1 > /proc/acpi/wakeup" sudo sh -c "echo USB2 > /proc/acpi/wakeup" sudo sh -c "echo USB3 > /proc/acpi/wakeup" The reason this is in rc.local, is that /proc/acpi/wakeup seems to be reset each time you boot, so we want to always set it to wakeup from the remote. Now you can test if you want, run pm-suspend, and the power button on your remote should wakeup your machine .NOTE: Your remote will do a whole lot of nothing now, lirc doesn't like running from being awakened, we will fix that next 4) Fix lirc's and mythtv's crazyness with sleep. Mythfrontend doesn't like sleep, neither does lirc. We need to kill them when we sleep, and restart them up again when we come out of sleep. Luckily, pm-utils has allows us to make our own scripts for sleeping I made a script in /usr/lib/pm-utils/sleep.d/00mythlirc (the lower numbers are run first on sleep, last one resume). It contains Code:
#!/bin/bash
. /usr/lib/pm-utils/functions
case "$1" in
suspend|hibernate)
killall mythfrontend.real
/etc/init.d/lirc stop
modunload lirc_mceusb2 lirc_dev
;;
resume|thaw)
modreload lirc_mceusb2 lirc_dev
/etc/init.d/lirc start
irexec -d
sleep 2
sudo -u mythtvuser mythfrontend &
;;
esac
The sleep is in there to make sure the network is up, 2 works well for me, but you may need to increase this if it takes longer for your mythmachine to connect to the network (other wise mythtv will ask you about your network settings, as it won't find the backend). sudo -u mythtvuser just makes sure we run the frontend as the normal mythtv user. I also have irexec -d in there, as my irexec dissapears when i come out of sleep. (we want to be able to have the machine sleep and resume an infinite amount of times). 5) Allow the remote to put the machine to sleep. To do this we just need to add in a line to ~/.lirc/mythtv which runs pm-suspend when whatever button is pressed (i used the power button). Code:
begin
remote = mceusb
prog = irexec
button = Power
config = sudo /usr/sbin/pm-suspend &
repeat = 0
delay = 0
end
I find it best to restart/ logout when you etc the lirc files, there is probably a more elegant way but this works for me. 6) Your finished (hopefully). Now you can power of the myth frontend into sleep when it's not being used, and bring it up reasonably quickly when you need to use it. I really wish you didn't have to kill mythfrontend when you sleep, as it takes a fairly long time to start, (for me this is from boot or from sleep). Hopefully that helps someone else who is looking to do this
|
|
|
|
|
|
#2 |
|
Furrius Animalus
Join Date: Jun 2001
Location: At a desk. Distro:Ubuntu
Posts: 5,200
|
Nice one!
I've measured the energy consumption of my MythTV backend server to be 17c per day (1.3Kwh consumed every 24 hours), so for $62.05 a year, I personally leave mine on 24/7, but my server also now does torrents and a VM to take advantage of idle time. Frontend machine(s), however, get switched off when not in use.
__________________
If practice makes perfect, and nobody's perfect, why practice? |
|
|
|
|
|
#3 |
|
with one 'L'
Join Date: Apr 2003
Location: Griffith NSW
Posts: 1,975
|
Just fyi, super-user is not needed to suspend the machine (eg since you can do it with a laptop lid close) - you can make use of the Desktop Environment's suspend utility:
Gnome: Code:
$ gnome-power-cmd command required: suspend, shutdown, hibernate or reboot http://linux-tipps.blogspot.com/2008...us-in-kde.html
__________________
sidux :: User :: Developer pcdb :: press folding :: for SunkenSite trades :: 100+ |
|
|
|
|
|
#4 |
|
Member
Join Date: Jul 2009
Posts: 4
|
This is fantastic Bojo. I went about setting this up this afternoon and it took me very little time to get it working perfectly. Would never have got this working without it.
I was able to skip step 3 entirely as my motherboard was happy to wake up without making any changes (Zotac Ionitx-A). Thanks! |
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|