mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #815 from pazos/master
move wifi.sh to networkmgr.lua
This commit is contained in:
1
Makefile
1
Makefile
@@ -140,7 +140,6 @@ koboupdate: all
|
||||
cp kobo/koreader.sh $(INSTALL_DIR)/koreader
|
||||
cp kobo/suspend.sh $(INSTALL_DIR)/koreader
|
||||
cp kobo/nickel.sh $(INSTALL_DIR)/koreader
|
||||
cp kobo/wifi.sh $(INSTALL_DIR)/koreader
|
||||
# create new package
|
||||
cd $(INSTALL_DIR) && \
|
||||
zip -9 -r \
|
||||
|
||||
@@ -18,11 +18,29 @@ local function kindleEnableWifi(toggle)
|
||||
end
|
||||
end
|
||||
|
||||
local function koboEnableWifi(toggle)
|
||||
if toggle == 1
|
||||
local path = "/etc/wpa_supplicant/wpa_supplicant.conf"
|
||||
os.execute("insmod /drivers/ntx508/wifi/sdio_wifi_pwr.ko 2>/dev/null")
|
||||
os.execute("insmod /drivers/ntx508/wifi/dhd.ko")
|
||||
os.execute("ifconfig eth0 up")
|
||||
os.execute("wlarm_le -i eth0 up")
|
||||
os.execute("wpa_supplicant -s -i eth0 -c "..path.." -C /var/run/wpa_supplicant -B")
|
||||
os.execute("udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1")
|
||||
else
|
||||
os.execute("killall udhcpc wpa_supplicant 2>/dev/null")
|
||||
os.execute("wlarm_le -i eth0 down")
|
||||
os.execute("ifconfig eth0 down")
|
||||
os.execute("rmmod -r dhd")
|
||||
os.execute("rmmod -r sdio_wifi_pwr")
|
||||
end
|
||||
end
|
||||
|
||||
function NetworkMgr:turnOnWifi()
|
||||
if Device:isKindle() then
|
||||
kindleEnableWifi(1)
|
||||
elseif Device:isKobo() then
|
||||
os.execute("./wifi.sh on")
|
||||
koboEnableWifi(1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +48,7 @@ function NetworkMgr:turnOffWifi()
|
||||
if Device:isKindle() then
|
||||
kindleEnableWifi(0)
|
||||
elseif Device:isKobo() then
|
||||
os.execute("./wifi.sh off")
|
||||
koboEnableWifi(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,11 +20,30 @@ export TESSDATA_PREFIX="data"
|
||||
# export dict directory
|
||||
export STARDICT_DATA_DIR="data/dict"
|
||||
|
||||
# exit from nickel
|
||||
killall nickel hindenburg fmon
|
||||
# fast and dirty way of check if we are called from nickel
|
||||
# through fmon, or from another launcher (KSM or advboot)
|
||||
from_nickel=`pidof nickel | wc -c`
|
||||
|
||||
# finally call the launcher
|
||||
./reader.lua /mnt/onboard 2> crash.log
|
||||
if [ $from_nickel -ne 0 ]; then
|
||||
# stop kobo software because is running
|
||||
killall nickel hindenburg fmon 2>/dev/null
|
||||
fi
|
||||
|
||||
# back to nickel
|
||||
./nickel.sh
|
||||
# fallback for old fmon (and advboot) users
|
||||
if [ `echo $@ | wc -c` -eq 1 ]; then
|
||||
args="/mnt/onboard"
|
||||
else
|
||||
args=$@
|
||||
fi
|
||||
|
||||
./reader.lua $args 2> crash.log
|
||||
|
||||
if [ $from_nickel -ne 0 ]; then
|
||||
# start kobo software because was running before koreader
|
||||
./nickel.sh
|
||||
else
|
||||
# if we were called from advboot then we must reboot to go to the menu
|
||||
if [ -d /mnt/onboard/.kobo/advboot ]; then
|
||||
reboot
|
||||
fi
|
||||
fi
|
||||
|
||||
23
kobo/wifi.sh
23
kobo/wifi.sh
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
export PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
case $1 in
|
||||
on )
|
||||
for mod in sdio_wifi_pwr dhd; do
|
||||
insmod /drivers/ntx508/wifi/${mod}.ko 2>/dev/null
|
||||
done
|
||||
sleep 1
|
||||
ifconfig eth0 up
|
||||
wlarm_le -i eth0 up
|
||||
wpa_supplicant -s -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B
|
||||
sleep 1
|
||||
udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1 &
|
||||
;;
|
||||
off )
|
||||
killall wpa_supplicant 2>/dev/null
|
||||
wlarm_le -i eth0 down
|
||||
ifconfig eth0 down
|
||||
rmmod -r dhd
|
||||
rmmod -r sdio_wifi_pwr
|
||||
;;
|
||||
esac
|
||||
@@ -167,12 +167,12 @@ msgid ""
|
||||
"Dewatermark"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/ui/networkmgr.lua:48
|
||||
#: frontend/ui/networkmgr.lua:66
|
||||
msgid ""
|
||||
"Do you want to Turn off Wifi?"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/ui/networkmgr.lua:39
|
||||
#: frontend/ui/networkmgr.lua:57
|
||||
msgid ""
|
||||
"Do you want to Turn on Wifi?"
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user