I've tried and apply the technique shown in Measuring Freerunner battery life for my FreeRunner which runs SHR-T.
Unfortunately, I couldn't recompile the wkalrm program on the freerunner (problems of compilation chain, I think). So I decided to use atd
to insert an at command which would wake up the FR... but that isn't exactly easy since no at command seems packaged for the atd-over-fso that comes with SHR-T (actually, there's an at
script provided in the initial atd version it was based on).
Thanks to help provided on the SHR ML, I've written this short resume-at
shell script that can be used to insert an at
command/script that will wake up the FR after a certain amount of minutes :
#!/bin/bash
# Will program an at job that will just execute in some number of minutes (passed in args)
# This script will do nothing, but can be interesting to wakeup the machine
# It uses atd-over-fso for atd execution
now=`date +'%s'`
minutes=$1
let "seconds = minutes * 60"
# add some minutes to now
let "time = now + seconds"
# filename for the at script
filename="/var/spool/at/$time.resume-at"
# Install the script
cat >$filename << EOF
#!/bin/sh
this="/var/spool/at/\$0"
echo \$this >>/tmp/resume-at.log
date >>/tmp/resume-at.log
rm \$this
echo "update" > /var/spool/at/trigger
EOF
# Make the at script executable
chmod +x $filename
# initialize the logs file
touch /tmp/resume-at.log
# Notify atd-over-fso that a new script was installed
echo "update" > /var/spool/at/trigger
Now, all that is left to do is to change the battery monitoring script to :
#!/bin/bashwhile :
do
echo ===========================================
date
cat /sys/class/power_supply/battery/capacity
cat /sys/class/i2c-adapter/i2c-0/0-0073/resume_reason
cat /sys/class/i2c-adapter/i2c-0/0-0073/neo1973-resume.0/resume_reason
#/root/wkalrm +30m
/home/root/resume-at 30
sleep 20
apm -sdone
The script has now been run, and here are the results : discharge in 66 hours and 10 minutes :
Hope this helps.