From 4a3f72e6ff5f10a8cbed97ed325a3acc90ec12c6 Mon Sep 17 00:00:00 2001 From: pazos Date: Sat, 19 Jul 2014 16:12:57 +0200 Subject: [PATCH 1/2] We don't support old kobo wifi devices --- kobo/nickel.sh | 26 ++++++-------------------- kobo/suspend.sh | 4 ++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/kobo/nickel.sh b/kobo/nickel.sh index dc00b3c19..58a3baa20 100644 --- a/kobo/nickel.sh +++ b/kobo/nickel.sh @@ -4,25 +4,11 @@ PATH=$PATH:/usr/sbin:/sbin # start fmon again: ( usleep 400000; /etc/init.d/on-animator.sh ) & -# environment needed by nickel, from /etc/init.d/rcS: -PLATFORM=freescale -if [ `dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 | grep -c "HW CONFIG"` == 1 ]; then - CPU=`ntx_hwconfig -s -p /dev/mmcblk0 CPU 2>/dev/null` - PLATFORM=$CPU-ntx -fi - -if [ $PLATFORM != freescale ]; then - INTERFACE=eth0 - WIFI_MODULE=dhd -else - INTERFACE=wlan0 - WIFI_MODULE=ar6000 -fi - -export PLATFORM -export INTERFACE -export WIFI_MODULE -export WIFI_MODULE_PATH=/drivers/$PLATFORM/wifi/$WIFI_MODULE.ko +# environment needed by nickel, from /etc/init.d/rcS: + +export INTERFACE=eth0 +export WIFI_MODULE=dhd +export WIFI_MODULE_PATH=/drivers/ntx508/wifi/$WIFI_MODULE.ko export NICKEL_HOME=/mnt/onboard/.kobo export LD_LIBRARY_PATH=/usr/local/Kobo @@ -51,7 +37,7 @@ if [ ! -e /usr/local/Kobo/platforms/libkobo.so ]; then /usr/local/Kobo/nickel -qws -skipFontLoad else /usr/local/Kobo/hindenburg & - insmod /drivers/$PLATFORM/misc/lowmem.ko & + insmod /drivers/ntx508/misc/lowmem.ko & [ `cat /mnt/onboard/.kobo/Kobo/Kobo\ eReader.conf | grep -c dhcpcd=true` == 1 ] && dhcpcd -d -t 10 & /usr/local/Kobo/nickel -platform kobo -skipFontLoad fi diff --git a/kobo/suspend.sh b/kobo/suspend.sh index 7dc47a589..5d460b8fb 100644 --- a/kobo/suspend.sh +++ b/kobo/suspend.sh @@ -5,8 +5,8 @@ export PATH=$PATH:/sbin:/usr/sbin if lsmod | grep -q sdio_wifi_pwr ; then wlarm_le -i eth0 down ifconfig eth0 down - /sbin/rmmod -r dhd - /sbin/rmmod -r sdio_wifi_pwr + rmmod -r dhd + rmmod -r sdio_wifi_pwr fi #go to sleep From 37d6239e203e58712e74cb29d8f996d4b4a889b5 Mon Sep 17 00:00:00 2001 From: pazos Date: Sat, 19 Jul 2014 16:32:41 +0200 Subject: [PATCH 2/2] Add wifi toggle for kobos --- Makefile | 1 + frontend/ui/networkmgr.lua | 4 ++-- kobo/wifi.sh | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 kobo/wifi.sh diff --git a/Makefile b/Makefile index cb6a6f534..38bf6475f 100644 --- a/Makefile +++ b/Makefile @@ -126,6 +126,7 @@ 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 7fa9115d3..4c7c53c92 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -22,7 +22,7 @@ function NetworkMgr:turnOnWifi() if Device:isKindle() then kindleEnableWifi(1) elseif Device:isKobo() then - -- TODO: turn on wifi on kobo? + os.execute("./wifi.sh on") end end @@ -30,7 +30,7 @@ function NetworkMgr:turnOffWifi() if Device:isKindle() then kindleEnableWifi(0) elseif Device:isKobo() then - -- TODO: turn off wifi on kobo? + os.execute("./wifi.sh off") end end diff --git a/kobo/wifi.sh b/kobo/wifi.sh new file mode 100644 index 000000000..910471f47 --- /dev/null +++ b/kobo/wifi.sh @@ -0,0 +1,23 @@ +#!/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