Add support for Koreader's WiFi manager

This commit is contained in:
Cosmin Gorgovan 2017-03-25 19:09:12 +00:00
parent 97b56e6857
commit b8fcc58715
8 changed files with 58 additions and 10 deletions

View File

@ -127,12 +127,16 @@ compile_koreader() {
cd opt cd opt
tar xf ../../koreader/koreader-kobo-arm-linux-gnueabihf*.targz tar xf ../../koreader/koreader-kobo-arm-linux-gnueabihf*.targz
echo "#!/bin/bash" > koreader/okreader.sh cp ../../../files/okreader.sh koreader/
echo "cd /opt/koreader" >> koreader/okreader.sh cp ../../../files/disable-wifi.sh koreader/
echo "while true; do" >> koreader/okreader.sh cp ../../../files/enable-wifi.sh koreader/
echo " ./luajit ./reader.lua /mnt" >> koreader/okreader.sh cp ../../../files/obtain-ip.sh koreader/
echo "done" >> koreader/okreader.sh cp ../../../files/release-ip.sh koreader/
chmod +x koreader/okreader.sh chmod +x koreader/disable-wifi.sh
chmod +x koreader/enable-wifi.sh
chmod +x koreader/obtain-ip.sh
chmod +x koreader/release-ip.sh
chmod +x koreader/restore-wifi-async.sh
cp ../../../files/defaults.persistent.lua koreader/ cp ../../../files/defaults.persistent.lua koreader/

View File

@ -87,7 +87,7 @@ config_rootfs() {
install_packages() { install_packages() {
cp src/linux-okreader-modules_2.6.35.3-1_armhf.deb rootfs/ cp src/linux-okreader-modules_2.6.35.3-1_armhf.deb rootfs/
cp src/firmware-okreader_1.0-1_armhf.deb rootfs/ cp src/firmware-okreader_1.0-1_armhf.deb rootfs/
cp src/koreader_2017.03-1_armhf.deb rootfs/ cp src/koreader_2017.03-2_armhf.deb rootfs/
cp src/kobo_hwconfig/kobo-hwconfig_1.0-1_armhf.deb rootfs/ cp src/kobo_hwconfig/kobo-hwconfig_1.0-1_armhf.deb rootfs/
chroot rootfs/ bash -c "dpkg -i /*.deb" chroot rootfs/ bash -c "dpkg -i /*.deb"

16
files/disable-wifi.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# Disable wifi, and remove all modules.
killall dhcpcd default.script wpa_supplicant 2>/dev/null
ifconfig wlan0 down
# Some sleep in between may avoid system getting hung
# (we test if a module is actually loaded to avoid unneeded sleeps)
if lsmod | grep -q $WIFI_MODULE ; then
rmmod $WIFI_MODULE
fi
if lsmod | grep -q sdio_wifi_pwr ; then
rmmod sdio_wifi_pwr
fi

12
files/enable-wifi.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# Load wifi modules and enable wifi.
lsmod | grep -q $WIFI_MODULE || modprobe $WIFI_MODULE
lsmod | grep -q sdio_wifi_pwr || modprobe sdio_wifi_pwr
sleep 1
ifconfig wlan0 up
pidof wpa_supplicant >/dev/null || \
( wpa_supplicant -D wext -iwlan0 -C /var/run/wpa_supplicant -B; \
ln -s /var/run/wpa_supplicant/wlan0 /var/run/wpa_supplicant/eth0 )

5
files/obtain-ip.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
./release-ip.sh
dhcpcd wlan0

8
files/okreader.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
export WIFI_MODULE=brcmfmac
cd /opt/koreader
while true; do
./luajit ./reader.lua /mnt
done

3
files/release-ip.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
pkill -9 -f 'dhcpcd'

View File

@ -1,5 +1,5 @@
Package: koreader Package: koreader
Version: 2017.03-1 Version: 2017.03-2
Maintainer: Cosmin Gorgovan <okreader@linux-geek.org> Maintainer: Cosmin Gorgovan <okreader@linux-geek.org>
Architecture: armhf Architecture: armhf
Description: An ebook viewer application. Description: An ebook viewer application.