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:
NiLuJe
2019-06-05 21:36:38 +02:00
committed by GitHub
parent 3798e1b72c
commit 89e002f236
4 changed files with 32 additions and 10 deletions

View File

@@ -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