set wakeup timer when rebooting

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2960 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2016-05-23 20:41:47 +00:00
parent e3e1fb618a
commit 0de011e28d
4 changed files with 115 additions and 7 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.3.0-5
Version: 1.3.0-6
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.23),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.3),hmt(>=2.0.9),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.8),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7)
Depends: tcpfix,webif-channelicons(>=1.1.23),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.3),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.9),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/7116/

View File

@ -11,6 +11,7 @@ cgi_input 1
set cb [[clipboard new {path "/tmp/webif-browse.cb"}] load]
set action [cgi_get act list]
set imgpath "/lib/jquery.plugin/contextMenu/images"
switch $action {
list {
@ -27,7 +28,7 @@ switch $action {
set path [$file get path]
set xpath [cgi_quote_html $path]
puts "<span title=\"$xpath\" alt=\"$xpath\">"
puts "<img src=/img/context/$img.png>"
puts "<img src=$imgpath/$img.png>"
set dfile [file tail $path]
if {[string length $dfile] > 25} {
set dfile "[string range $dfile 0 22]..."

View File

@ -1,8 +1,111 @@
#!/bin/sh
#exec >>/tmp/reboot.log 2>&1
if [ "$1" = "-f" -a "$0" != "/tmp/fastreboot" ]; then
cp $0 /tmp/fastreboot
chmod 755 /tmp/fastreboot
exec /tmp/fastreboot -f
exit 0
fi
readwakeup()
{
# Read the wakeup timer from the front panel
tries=10
while [ $tries -gt 0 ]; do
wakeup="`/mod/bin/hwctl d`"
[ -n "$wakeup" ] && break
tries=$((tries - 1))
sleep 1
done
echo "Wakeup: $wakeup"
}
setwakeup()
{
tries=10
while [ $tries -gt 0 ]; do
echo "Setting wakeup timer..."
/mod/bin/hwctl 5 1 ^`date +%s` >/dev/null
tries=$((tries - 1))
if readwakeup | grep "00 00 00 00"; then
sleep 1
continue
fi
echo "Success"
break
done
}
lbr=0
if [ -f /tmp/.lbr ]; then
lbr="`cat /tmp/.lbr`"
echo "LBR: $lbr"
else
# No last-boot-reason file, fall-back to reading timer directly.
echo "No .lbr, falling back to timer..."
if readwakeup | grep "00 00 00 00"; then
echo "Setting LBR=3"
lbr=3
fi
fi
if [ $lbr -eq 3 ]; then
# Last boot was for scheduled recording. Need to set a wakeup
# flag in the Micom or the reboot will result in the Humax
# software just powering down (it presumably think that there has
# been a power failure).
readwakeup # For interest
setwakeup
readwakeup
fi
# Normal reboot.
if [ "$1" != "-f" ]; then
/etc/init.d/S90settop shut
/mod/bin/sync
/sbin/reboot
exit 0
fi
######################################################################
# Fast reboot, thanks to work by prpr
model="`cat /etc/model`"
# Stop mod services
for f in /mod/etc/init.d/S??*; do
[ -f "$f" ] || continue
$f stop
done
# Stop Humax App
/etc/init.d/S90settop shut
/mod/bin/sync
/sbin/reboot
# Kill DHCP daemon
killall udhcpc
# Stop any processes still using the disk
#sleep 1
#[ "$model" = "HDR" ] && part=/mnt/hd2 || part=/media/drive1
#lsof -t $part | xargs kill -9
# Unmount disks
mount | grep '^/dev/sd' | awk '{print $1}' | xargs umount -l
# Stop device
for f in /sys/block/sd?; do
echo 1 >> $f/device/delete
done
# Restart xinit modules
/etc/init.d/S80xinit start
# Restart Humax app
/etc/init.d/S90settop resume
exit 0

View File

@ -453,8 +453,12 @@ proc {system dirinuse} {dir} {
return $files
}
proc {system reboot} {} {
exec /mod/webif/lib/bin/reboot
proc {system reboot} {{fast 0}} {
if {$fast} {
exec /mod/webif/lib/bin/reboot -f
} else {
exec /mod/webif/lib/bin/reboot
}
}
proc {system restartpending} {{mode 1}} {