mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[fix] make wifi control work with my Kobo Touch N905 (#3920)
This commit is contained in:
committed by
Frans de Jonge
parent
24d4ab43c4
commit
a3e16b3920
@@ -199,7 +199,7 @@ function Device:retrieveNetworkInfo()
|
||||
if std_out then
|
||||
local result = std_out:read("*all")
|
||||
std_out:close()
|
||||
std_out = io.popen('iwconfig eth0 | grep ESSID | cut -d\\" -f2')
|
||||
std_out = io.popen('2>/dev/null iwconfig | grep ESSID | cut -d\\" -f2')
|
||||
if std_out then
|
||||
local ssid = std_out:read("*all")
|
||||
result = result .. "SSID: " .. ssid:gsub("(.-)%s*$", "%1") .. "\n"
|
||||
|
||||
@@ -237,7 +237,7 @@ function Kobo:initNetworkManager(NetworkMgr)
|
||||
end
|
||||
|
||||
NetworkMgr:setWirelessBackend(
|
||||
"wpa_supplicant", {ctrl_interface = "/var/run/wpa_supplicant/eth0"})
|
||||
"wpa_supplicant", {ctrl_interface = "/var/run/wpa_supplicant/" .. os.getenv("INTERFACE")})
|
||||
|
||||
function NetworkMgr:obtainIP()
|
||||
os.execute("./obtain-ip.sh")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
killall udhcpc default.script wpa_supplicant 2>/dev/null
|
||||
|
||||
[ "${WIFI_MODULE}" != "8189fs" ] && wlarm_le -i eth0 down
|
||||
ifconfig eth0 down
|
||||
ifconfig "${INTERFACE}" down
|
||||
|
||||
# Some sleep in between may avoid system getting hung
|
||||
# (we test if a module is actually loaded to avoid unneeded sleeps)
|
||||
|
||||
@@ -8,9 +8,9 @@ lsmod | grep -q "${WIFI_MODULE}" || insmod "${WIFI_MODULE_PATH}"
|
||||
# Race-y as hell, don't try to optimize this!
|
||||
sleep 1
|
||||
|
||||
ifconfig eth0 up
|
||||
[ "$WIFI_MODULE" != "8189fs" ] && wlarm_le -i eth0 up
|
||||
ifconfig "${INTERFACE}" up
|
||||
[ "$WIFI_MODULE" != "8189fs" ] && wlarm_le -i "${INTERFACE}" up
|
||||
|
||||
pidof wpa_supplicant >/dev/null \
|
||||
|| env -u LD_LIBRARY_PATH \
|
||||
wpa_supplicant -D wext -s -i eth0 -O /var/run/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -B
|
||||
wpa_supplicant -D wext -s -i "${INTERFACE}" -O /var/run/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -B
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
./release-ip.sh
|
||||
|
||||
# Use udhcpc to obtain IP.
|
||||
env -u LD_LIBRARY_PATH udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q
|
||||
env -u LD_LIBRARY_PATH udhcpc -S -i "${INTERFACE}" -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q
|
||||
|
||||
@@ -5,4 +5,4 @@ export PATH="${PATH}:/sbin"
|
||||
|
||||
# Release IP and shutdown udhcpc.
|
||||
pkill -9 -f '/bin/sh /etc/udhcpc.d/default.script'
|
||||
ifconfig eth0 0.0.0.0
|
||||
ifconfig "${INTERFACE}" 0.0.0.0
|
||||
|
||||
Reference in New Issue
Block a user