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

@@ -311,7 +311,13 @@ function Device:retrieveNetworkInfo()
std_out:close()
end
if os.execute("ip r | grep -q default") == 0 then
local pingok = os.execute("ping -q -w 3 -c 2 `ip r | grep default | cut -d ' ' -f 3` > /dev/null")
-- NOTE: No -w flag available in the old busybox build used on Legacy Kindles...
local pingok
if self:isKindle() and self:hasKeyboard() then
pingok = os.execute("ping -q -c 2 `ip r | grep default | cut -d ' ' -f 3` > /dev/null")
else
pingok = os.execute("ping -q -w 3 -c 2 `ip r | grep default | cut -d ' ' -f 3` > /dev/null")
end
if pingok == 0 then
result = result .. "Gateway ping successful"
else