diff --git a/Makefile b/Makefile index 13da0866f..9603416ae 100644 --- a/Makefile +++ b/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 \ diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua index 4c7c53c92..af720df67 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -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 diff --git a/kobo/koreader.sh b/kobo/koreader.sh index 451f838b6..bc4c6aa17 100755 --- a/kobo/koreader.sh +++ b/kobo/koreader.sh @@ -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 diff --git a/kobo/wifi.sh b/kobo/wifi.sh deleted file mode 100644 index 910471f47..000000000 --- a/kobo/wifi.sh +++ /dev/null @@ -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 diff --git a/l10n/templates/koreader.pot b/l10n/templates/koreader.pot index 764a7fc12..f958238dc 100644 --- a/l10n/templates/koreader.pot +++ b/l10n/templates/koreader.pot @@ -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 ""