View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 58 posts ] 
Go to page 1, 2, 3, 4  Next

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: ACPI wakeup
PostPosted: Fri Jan 19, 2007 3:52 pm 
Offline
Joined: Tue Feb 14, 2006 4:45 am
Posts: 21
Location: UK
I did a quick search and it doesn't appear anyones posted on using acpi to wake to record.

I've managed to get this working on R5D1 and R5E50 using the page

http://www.mythtv.org/wiki/index.php/ACPI_Wakeup

Can't remember why I didn't use the script give on the above page (I think it wouldn't work with mythwelcome) so I use the following

Code:
#!/bin/bash

# Script to set wakeup time using acpi alarm
# Called from mythwellcome
# first option passed from mythwelcome is --settime second is time since 1970

# save the system clock to hw clock
# if this is done on shutdown it needs to be disabled as it will not wakeup
hwclock --systohc

#for testing
#stamp_file=/home/mythtv/timestamp

#convert from stupid time in seconds since 1970
b=$(date -d "1970-01-01 UTC $2 sec" +%F\ %T)

# write the time to a test file
#echo $1\ $2 \$b >$stamp_file

#write wakeup time to acpi alarm
echo $b>/proc/acpi/alarm


It worked straight away on R5D1 but on R5E50 i had to disable the system clock update on shutdown as in the 'Fussy Bios' section.

I hope this helps someone who can't use nvram-wakeup.

Tom


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 19, 2007 8:37 pm 
Offline
Joined: Wed Apr 28, 2004 10:42 pm
Posts: 405
Location: Bendigo, Victoria, Australia
I would like to give this a go but am unsure what settings go where. What settings do you have in Mythtv-setup and mythwelcome?

_________________
Paul Turpie
-------------
<--Is your location in your profile? Why not?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 20, 2007 5:51 am 
Offline
Joined: Tue Feb 14, 2006 4:45 am
Posts: 21
Location: UK
Heres my notes of what I did:

1) Start mythwelcome on boot up:

nano /home/mythtv/.fluxbox/apps

change "[startup] {KnoppMyth-run}" to "[startup] {mythwelcome}"

2) myth-setup

Set wakeuptime command: "sudo mythshutdown --setwakeup $time"
wakeup time format: "yyyy-MM-ddThh:mm"
halt command: "sudo mythshutdown --shutdown"
startup command: ""
pre-shutdown command: "sudo mythshutdown --check"
idle timeout: "10" seconds

(Note: IMPORTANT! You might want to set this to something higher to test first... otherwise the system might go into a reboot loop with only 10 seconds to stop it)
* Make sure you check the "block shutdown before client connected" option *

Startup before rec. (secs): 300

3) copy wakeup script somewhere (/usr/bin/setwakeup.sh) and make executable.

chmod +x /usr/bin/setwakeup.sh

4) Configure mythwelcome. While logged in as mythtv, type

mythwelcome --setup

This presents an interface similar to mythtv-setup. Edit the settings according to your configuration. I had:

nvram-wakeup Command: sudo /usr/bin/setwakeup.sh
nvram-wakeup Restart Command: blank
Command to reboot: sudo shutdown -h
Command to shutdown: sudo shutdown -h
Command to run Xterm: xterm
Command to run to start the Frontend: KnoppMyth-run

5) Disable the time update on shutdown, in /etc/init.d hwclock.sh (the clock is saved to the bios in setwakeup.sh before the alarm is set)

In mythwelcome pressing "i" gives you some more options for setting a daily wakeup/shutdown period. "M" gives you some more actions such as filldatabase, shutdown now, lock shutdown - so it doesn't automatically shutdown when you're doing something.

You might want to check that the scripts calcuating the wakeup time correctly as I've only used in during GMT so I don't know if it will work for other timezones (or daylight saving time). Comment out the echo to the alarm line in the script and uncomment the stampfile bit, and lose the shutdown commands in mythwelcome. It should go though a ll the motions of shutting down but not do anything and you can check that it setting the right time in the stamp file.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 1:51 am 
Offline
Joined: Thu Feb 01, 2007 12:44 am
Posts: 66
Location: Dallas, TX
I was trying to use ACPI also as my motherboard doesn't support nvram-wakeup, and I was scared of guess-helper and bricking my motherboard.

But when I try the directions
root# powersave -S
I get
bash: powersave: command not found

I figured I needed to install ACPI support so I tried
root# apt-get install acpid
And I get
reading package lists... done
building dependency tree... done
E: couldn't find package apcid

So I figured I needed to download the package. I went to http://acpi.sourceforge.net/ and I don't see a package for kernel 2.6.18 which is what R5E50 is using according to uname -r

Would anyone point me in the right direction? This is my first experience with linux. I have searched several forums and not found anything I can follow.

Thanks.

_________________
Trying to install KnoppMyth R5F27, ECS 671T-M, Celeron 430, 1gig RAM, 320gig SATA Seagate, Samsung SATA SH-S203N DVD drive, Onboard video and audio, DVICO Fusion HDTV 5 Lite, Seasonic S12II-330watt PS


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 4:22 pm 
Offline
Joined: Wed Apr 28, 2004 10:42 pm
Posts: 405
Location: Bendigo, Victoria, Australia
The powersave command doesn't seem to be in R5D1 either but I dont think you need it. I think you should be able to get it to work by just modifying /proc/acpi/alarm.

Remember though that the RTC is in UTM not your local time zone. One afternoon I was experimenting with ACPI and tried to set the wakeup time to 6PM but it didn't seem to work, but the next morning I found it had woken up at 4am instead (we are 10 hours ahead of UTM here.)

_________________
Paul Turpie
-------------
<--Is your location in your profile? Why not?


Top
 Profile  
 
PostPosted: Fri Feb 02, 2007 10:24 am 
Offline
Joined: Thu Feb 01, 2007 12:44 am
Posts: 66
Location: Dallas, TX
I got tired that night and shut down Myth after not resolving why I couldn't follow that Wiki article. When I came home the darn thing had started up and was recording. I guess there is no installation required for R5E50. But it didn't turn off. Now I just need to figure out how to change over to the myth-welcome screen so it will shutdown when the recordings are complete.

_________________
Trying to install KnoppMyth R5F27, ECS 671T-M, Celeron 430, 1gig RAM, 320gig SATA Seagate, Samsung SATA SH-S203N DVD drive, Onboard video and audio, DVICO Fusion HDTV 5 Lite, Seasonic S12II-330watt PS


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 3:23 pm 
Offline
Joined: Tue Feb 14, 2006 4:45 am
Posts: 21
Location: UK
RE powersave: I didn't need this either and just skipped this when I saw that proc/acpi/alarm existed.

I still haven't quite got mythwelcome working perfectly, most of the time it boots up and shutdown fine but occasionally it won't shutdown after a recording. I think this may be because I have to have a wakeup period each day as my motherboards alarm has no date function.


Top
 Profile  
 
PostPosted: Mon Feb 12, 2007 8:00 pm 
Offline
Joined: Tue Oct 24, 2006 8:13 pm
Posts: 40
I haven't tried tackling the wake to record because of the warning from the link that tohc1 started this thread with:

Excerpt....
Note: Testing this on kernel 2.6.17-gentoo-r4 and r7, revealed that you will only have this option on x86_64 architecture. The setup of /proc/acpi/alarm is done in kernel file drivers/acpi/sleep/proc.c and controlled by the CONFIG_ACPI_SLEEP_PROC_FS flag. You can test support for you architecture by going to you kernel source and do:

Did you have to do something else, or is this note not applicable anymore for some reason?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 10:06 pm 
Offline
Joined: Wed Apr 28, 2004 10:42 pm
Posts: 405
Location: Bendigo, Victoria, Australia
You don't need x86_64, I can do a ACPI wakeup with my Asus M2NPV-VM using Knoppmyth R5D1, if I set the wakeup alarm manually.

I am still working on getting mythtv to set the wakeup alarm time automatically. It is probably a permissions problem on my system.

_________________
Paul Turpie
-------------
<--Is your location in your profile? Why not?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 13, 2007 3:05 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
turpie wrote:
I am still working on getting mythtv to set the wakeup alarm time automatically. It is probably a permissions problem on my system.


On my system only root had write access to /proc/acpi/alarm and changing it would not survive a reboot.

To work around the problem, I wrote the time to a file (/tmp/alarm) instead of /proc/acpi/alarm in the script called by mythwelcome to set the wakeup time. Then I modified the fussy bios I fix http://www.mythtv.org/wiki/index.php/AC ... Fussy_Bios to take the time from this file and write it to /proc/acpi/alarm on shutdown.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 6:59 pm 
Offline
Joined: Wed Apr 28, 2004 10:42 pm
Posts: 405
Location: Bendigo, Victoria, Australia
Thanks for the tip Alien I'll give that a go this weekend.

This problem has been really bugging me. Each night this week I try tweaking some settings, but because I have a heap of stuff scheduled it wont shut down until later at night. So I schedule a recording for just after I get up in the morning, but each morning nothing happens.

I have my wakeup script and mythshutdown in my /etc/sudoers file. As the mythtv user I can run the script with sudo and it will set the alarm and wakeup correctly.

_________________
Paul Turpie
-------------
<--Is your location in your profile? Why not?


Top
 Profile  
 
 Post subject: Can't get PC to wake up
PostPosted: Sat Feb 17, 2007 3:06 pm 
Offline
Joined: Tue Oct 24, 2006 8:13 pm
Posts: 40
I've been able to get a new time to the RTC but PC doesn't wake up. When I reboot, the alarm time has changed leading me to believe I need to try writing to /tmp/alarm and then passing that data back to /proc/acpi/alarm in /etc/init.d/hwclock.sh (see excerpt). What am I doing wrong?

[u]Before reboot: [\u]
oot@mythtv:/usr/bin# echo "2007-02-25 11:51:04" >/proc/acpi/alarm
root@mythtv:/usr/bin# cat /proc/acpi/alarm
2007-02-25 11:51:04
root@mythtv:/usr/bin# echo "2007-02-25 11:51:04" >/tmp/alarm
root@mythtv:/usr/bin# cat /tmp/alarm
2007-02-25 11:51:04
root@mythtv:/usr/bin# /etc/init.d/hwclock.sh
Usage: hwclock.sh {start|stop|reload|force-reload|show}
start sets kernel (system) clock from hardware (RTC) clock
stop and reload set hardware (RTC) clock from kernel (system) clock
root@mythtv:/usr/bin# /etc/init.d/hwclock.sh start

Setting the System Clock using the Hardware Clock as reference...
System Clock set. Local time: Sat Feb 17 12:25:23 PST 2007

root@mythtv:/usr/bin# cat /tmp/alarm
2007-02-25 11:51:04
root@mythtv:/usr/bin# cat /proc/acpi/alarm
2007-02-25 11:51:04

[u] After reboot [\u]
sh-3.00$ su
Password:
root@mythtv:/home/mythtv# cat /proc/acpi/alarm
2007-02-00 11:51:04


[u] excerpt from /etc/init.d/hwclock.sh [\u]
#I added next two lines
# ACPITIME='cat /proc/acpi/alarm'
ACPITIME='cat /tmp/alarm'

if [ "$HWCLOCKACCESS" != no ]
then
if [ "$VERBOSE" != no ]
then
echo "Saving the System Clock time to the Hardware Cloc$
fi
[ "$GMT" = "-u" ] && GMT="--utc"
/sbin/hwclock --systohc $GMT $BADYEAR
if [ "$VERBOSE" != no ]
then
echo "Hardware Clock updated to `date`."
fi
#I added next line
echo "$ACPITIME" > /proc/acpi/alarm


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 11:14 am 
Offline
Joined: Tue Feb 14, 2006 4:45 am
Posts: 21
Location: UK
If setting the alarm after changing the clock doesn't work, trty the other things in the fussy bios sections in the link. I'd try:

1) make sure that RTC alarm is enabled in the bios if it's setting the alarm correctly maybe it's just not trying to wake up?

2) Try disabling the RTC alarm in the bios - apparently this sometimes works.

3) Try writing the alarm time twice.


Top
 Profile  
 
 Post subject: Re: ACPI wakeup
PostPosted: Sun Feb 18, 2007 5:27 pm 
Offline
Joined: Wed Apr 28, 2004 10:42 pm
Posts: 405
Location: Bendigo, Victoria, Australia
Tohc1,
Thanks for your instructions and script. I have finally gotten this working on my machine.

I did have to make one change though to deal with timezone issues.

I had to change this line in the script:
Code:
#convert from stupid time in seconds since 1970
b=$(date -d "1970-01-01 UTC $2 sec" +%F\ %T)

To this:
Code:
#convert from stupid time in seconds since 1970
b=$(date -ud "1970-01-01 UTC $2 sec" +%F\ %T\ %z)

The -u and %z options allow it to work in my timezone.

_________________
Paul Turpie
-------------
<--Is your location in your profile? Why not?


Top
 Profile  
 
PostPosted: Mon Feb 19, 2007 2:45 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
pairajacks wrote:
ACPITIME='cat /tmp/alarm'
...
echo "$ACPITIME" > /proc/acpi/alarm

I don't think that will work. I suspect that will just put the string "cat /tmp/alarm" into /proc/acpi/alarm.

I would recommend setting the second line to
Code:
cat /tmp/alarm > /proc/acpi/alarm
and deleting the first one.

As recommended above, if you are having problems, you should check the other fussy bios issues. Also, I find testing by hand first (i.e. not worrying about mythwelcome) helps reduce some of the unknowns. First get it to wakeup by doing the cat/halt by hand. Then configure mythwelcome.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ] 
Go to page 1, 2, 3, 4  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu