mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Minor networking fixes on legacy Kindles (#5059)
* Allow toggling WiFi & Suspend on legacy Kindles * Fix ping invocations on Legacy Kindles * Don't crash when disabling WiFi on legacy Kindles
This commit is contained in:
@@ -102,7 +102,12 @@ function NetworkMgr:isConnected()
|
||||
return self:isWifiOn()
|
||||
else
|
||||
-- `-c1` try only once; `-w2` wait 2 seconds
|
||||
return 0 == os.execute([[ping -c1 -w2 $(/sbin/route -n | awk '$4 == "UG" {print $2}')]])
|
||||
-- NOTE: No -w flag available in the old busybox build used on Legacy Kindles...
|
||||
if Device:isKindle() and Device:hasKeyboard() then
|
||||
return 0 == os.execute([[ping -c1 $(/sbin/route -n | awk '$4 == "UG" {print $2}')]])
|
||||
else
|
||||
return 0 == os.execute([[ping -c1 -w2 $(/sbin/route -n | awk '$4 == "UG" {print $2}')]])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user