From 747c3eaf9d72414d272f5de7c743e4a0153c9012 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Tue, 31 Jan 2023 14:38:22 -0500 Subject: [PATCH] Kindle: NetworkMgr: isWifiOn isConnected (#10059) isWifiOn for kindle currently returns if the interface is connected, change this to doing what is says isWifiOn the file is only present if the wireless interface is up. isConnected pings the gateway, rely on the kernel for a more reliable check. Whan connecting to my android phone's wifi hotspot to remote debug from my phone, the network is connected yet the phone(gateway) does not respond to pings leading koreader to shut down the connection thinking it is unsuccessful --- frontend/device/kindle/device.lua | 2 +- frontend/ui/network/manager.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index 8d9f7c7f0..f54f94a2a 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -84,7 +84,7 @@ local function isWifiUp() local out = file:read("*number") file:close() - return out == 1 + return true, out == 1 end --[[ diff --git a/frontend/ui/network/manager.lua b/frontend/ui/network/manager.lua index 3c87f6cb6..786ebd824 100644 --- a/frontend/ui/network/manager.lua +++ b/frontend/ui/network/manager.lua @@ -248,6 +248,9 @@ end function NetworkMgr:isConnected() if Device:isAndroid() or Device:isCervantes() or Device:isPocketBook() or Device:isEmulator() then return self:isWifiOn() + elseif Device:isKindle() then + local on, connected = self:isWifiOn() + return on and connected else -- Pull the default gateway first, so we don't even try to ping anything if there isn't one... local default_gw