[mythtv-users] Wakeup using acpi instead of nvram
Michelle Dupuis
support at ocg.ca
Wed Jul 18 18:52:32 UTC 2007
After some struggling, and realizing that my motherboard wouldn't work with
nvram-wakeup, I wrote a simple bash script to set the wakeup time using the
/proc ACPI interface. The script called "acpi-wakeup" is below, and is
parameter compatible with nvram-wakeup.
Cheers,
Md
-----------------------------------------------------------------
#!/bin/bash
# Set the wakeup time using proc ACPI interface, instead of writing to NVRAM
# By Michelle DUpuis
# support at ocg.ca
# Version 0.1
PARAMERROR=
if [ $# -lt 2 ] ; then
PARAMERROR="Too few parameters."
elif [ $# -gt 3 ] ; then
PARAMERROR="Too many parameters."
else
if [ $# -eq 2 ] ; then
PFLAG=$1
PEPOCH=$2
PVERBOSE=""
else
PFLAG=$2
PEPOCH=$3
PVERBOSE=$1
fi
NOW_EPOCH=$(date "+%s")
if [ $NOW_EPOCH -gt $PEPOCH ] ; then
PARAMERROR="Passed time (in epoch format) has already passed."
else
#For testing, next line sets input time to July 18 2007, 4:39pm
#PEPOCH="1184791140"
NEW_TIME=$(date -d "1970-01-01 ${PEPOCH} sec GMT" "+%Y-%m-%d
%H:%M:%S")
fi
if [ -z "$PARAMERROR" ] ; then
if [ $PFLAG != "--settime" ] ; then
PARAMERROR="Invalid parameter format."
else
if [ "$PVERBOSE" = "-v" ] ; then
echo "acpi-wakup version 0.1"
echo " Time passed in epoch format: [$PEPOCH]"
echo " Computed wakeup time: [$NEW_TIME]"
elif [ -n "$PVERBOSE" ] ; then
PARAMERROR="Unexpected final parameter encountered."
fi
fi
fi
fi
if [ -n "$PARAMERROR" ] ; then
echo "acpi-wake version 0.1"
echo ""
echo " Error: $PARAMERROR"
echo ""
echo " Usage: acpi-wakeup [ -v ] --settime XXXXXXXX"
echo ""
else
echo "$NEW_TIME" > /proc/acpi/alarm
if [ "$PVERBOSE" = "-v" ] ; then
echo " Confirmed ACPI wakeup alarm:"$(cat /proc/acpi/alarm)
fi
fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20070718/582a6ff0/attachment.htm
More information about the mythtv-users
mailing list