Skip to content

Instantly share code, notes, and snippets.

@creaktive
Last active June 19, 2017 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creaktive/b0c593dda795167e7f63817433d41190 to your computer and use it in GitHub Desktop.
Save creaktive/b0c593dda795167e7f63817433d41190 to your computer and use it in GitHub Desktop.
#!/bin/sh
wifienable() {
lipc-set-prop com.lab126.wifid enable 1
}
wifidisable() {
lipc-set-prop com.lab126.wifid enable 0
}
wait_for_wifi() {
#return true if keyword not found
return `lipc-get-prop com.lab126.wifid cmState | grep CONNECTED | wc -l`
}
wait_for_ready_suspend() {
return `powerd_test -s | grep 'Ready' | wc -l`
}
wait_for_defer_suspend() {
return `powerd_test -s | grep 'defer_suspend:1' | wc -l`
}
# lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
wifienable
while wait_for_wifi; do sleep 1; done
battery=`gasgauge-info -s 2>/dev/null | sed -ne 's/\([0-9]\+\).*/\1/p'`
tmp_file=/tmp/forecast.png
rm -f $tmp_file
if wget -q -O $tmp_file "http://sysd.org/kindle/forecast.php?b=$battery"; then
# eips -c
eips -c
# eips -g $tmp_file
eips -g $tmp_file
mv $tmp_file /mnt/us/screen_savers/600x800/01N.png
fi
if [ wait_for_defer_suspend ]; then
echo $battery
else
while wait_for_ready_suspend; do sleep 1; done
lipc-set-prop com.lab126.powerd deferSuspend 32000000
fi
wifidisable
#!/bin/sh
sleep 600
/etc/init.d/framework stop
/mnt/us/weather/display-weather.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment