Rtc wakeup

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
Andrew C
Newcomer
Posts: 12
Joined: Mon Feb 24, 2014 5:21 am
Contact:

Rtc wakeup

Post by Andrew C » Fri Feb 28, 2014 1:50 am

Mythtv used to sleep and wakeup in time to record shows. Now it doesn't. The chamge came in the middle of last year when I upgraded to 0.26 and fitted a Radeon 7790 (terrible idea as it turns out). I'm now using Ubuntu 13.10, with a 3.11 kernel.

This is not really a mythtv problem, but its one that myth users seem to be the leaders in.

Dmesg | grep rtc shows rtc_CMOS module loaded, and reports 'can wake up from S5'. PCI ID is pci:000000:2.0 or something like that.

/process/acpi/wakeup shows PCE2 with the same pci ID but 'disabled'. I enable with >echo "PCE2" > /process/acpi/wakealarm. (Need to do this as root - sudo doesn't have permission)

Then the tests of echo 0 >/sys/class/rtc/rtc0/wakealarm seem to work, but the darn thing will not wake up.

I usually use rtcwake to set wakeup and shutdown, and using -m no setting indicates that the problem is not that its miscalculating the time and setting a wakeup too far in the future or in the past.

I have disabled high precision event timing. I'm using an ASUS M4A785T-M motherboard with the latest BIOS released, with an Athlon x4 620e.

Anyone have any suggestions?
Using Tapatalk

Andrew C
Newcomer
Posts: 12
Joined: Mon Feb 24, 2014 5:21 am
Contact:

Re: Rtc wakeup

Post by Andrew C » Sun Mar 02, 2014 10:42 am

Made some progress on this when I thought about why 'rtcwake -m on' would behave differently to '-m off'. Turns out my hwclock.conf and hwclock-save.conf in /etc/init/ were assuming rtc was UTC (which it isn't.). Also, I hadn't made the right changes in hwclock-save.conf. So, it is more or less working (mythbackend service requires more attention to start with boot up, which is pretty central to the use case, but not part of this problem). All that stuff about enabling device wakeup was a red herring for my config.
Using Tapatalk

Pugwash
Newcomer
Posts: 2
Joined: Mon Apr 13, 2015 12:53 am
Canada

Re: Rtc wakeup

Post by Pugwash » Mon Apr 13, 2015 1:13 am

Hi
lots of MB/CPU combinations require hpet=disable as a kernel parameter to work reliably.
This is my simple script. THe Hardware clock runs in UTC. The time supplied is UTCTIME UTCDATE.

The last lines are how I got rtcwake to work..
The first lines are to get it to wake ate 06:00 EST or when mythwants to record which ever is earlier. Cron Tasks fire off at 06:05. ANd then myth sleeps it again.


#!/bin/bash
# This script sets the wake up time using rtcwake
# and is designed to work from myth setwaketime call

#our log file
SAY() {
/usr/bin/logger -p info -t $MENAME $1
}

MENAME=$(basename $0)
MEDIR=$(dirname $0)

YUMHOUR="06:00:00"
# YUMHOUR="13:10:00"

#Log starting
SAY "Called with [$1] [$2]"

#get next yum update time
YUMLOCALTZ=`date +%Z`
YUMTOMORROWUDT=$(/bin/date -u -d "tomorrow $YUMHOUR $YUMLOCALTZ" +%s)
YUMTODAYUDT=$(/bin/date -u -d "today $YUMHOUR $YUMLOCALTZ" +%s)
TIMENOW=$(/bin/date +%s)
if (( $TIMENOW < $YUMTODAYUDT )) ; then
SAY "Using Today"
YUMNEXTTIMEUDT=$YUMTODAYUDT
else
SAY "Using Tommorrow"
YUMNEXTTIMEUDT=$YUMTOMORROWUDT
fi
# YUMNEXTTIMEUDT=$(/bin/date -u -d "today $YUMHOUR $YUMLOCALTZ" +%s)

#if we have been given a date to use check if its earlier than YUM
if [ "$1" != "" ] && [ "$2" != "" ]
then
MYTHNEXTTIMEUDT=$(/bin/date -d "$2 $1" +%s)
#use lesser
SAY "Yum [$YUMNEXTTIMEUDT] Myth [$MYTHNEXTTIMEUDT]"
if (( $YUMNEXTTIMEUDT < $MYTHNEXTTIMEUDT )) ; then
DateToSet=$YUMNEXTTIMEUDT
SAY "Setting wakeup according to yum"
else
DateToSet=$MYTHNEXTTIMEUDT
SAY "Setting wakeup according to myth"
fi
elif [ "$1" = "" ] && [ "$2" = "" ] ; then
DateToSet=$YUMNEXTTIMEUDT
SAY "Force setting wakeup according to yum"
else
#we cant do anything
SAY "Aborting, no input parameters"
exit 1
fi

#set the wakeup
SAY "First clear rtcwake"
RTCRESULT=`/usr/sbin/rtcwake -m disable`
SAY "Then set rtcwake $DateToSet"
RTCRESULT=`/usr/sbin/rtcwake -u -m no -t $DateToSet`
SAY "$RTCRESULT"
RTCRESULT=`/usr/sbin/rtcwake -m show`
SAY "rtcreports $RTCRESULT"

Post Reply