Skip to content

Commit

Permalink
align with KOSSH version
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed May 13, 2022
1 parent d6153f2 commit 1af4ea5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions filebrowser_wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
col=30
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

# enable wireless if it is currently off
WIFI_WAS_OFF=0
if [ 0 -eq `lipc-get-prop com.lab126.cmd wirelessEnable` ]; then
Expand All @@ -24,9 +25,17 @@ while :; do
done > /dev/null &

# waiting for powerButtonPressed
lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
PSS_WAS_OFF=0
if [ 0 -eq `lipc-get-prop com.lab126.powerd preventScreenSaver` ]; then
lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
PSS_WAS_OFF=1
fi
lipc-wait-event com.lab126.hal powerButtonPressed | read event #it's blocking
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
# Restore PSS status
if [ 1 -eq $PSS_WAS_OFF ]; then
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
fi

kill $(jobs -p)
eips $col 3 "File Browser is turned off. "

Expand All @@ -41,5 +50,7 @@ fi
sleep 1
eips $col 1 " "
eips $col 3 " "

# stop tasks
killall filebrowser
ps aux | grep [f]ilebrowser | awk '{print $2}' | xargs -i kill {} > /dev/null

0 comments on commit 1af4ea5

Please sign in to comment.