From c11a2bbf1e0f86eb29fdee7520c85052dc9754df Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 20 Jan 2015 00:07:36 +0800 Subject: [PATCH] fix ota update for PocketBook --- Makefile | 3 +++ frontend/ui/elements/common_info_menu_table.lua | 2 +- frontend/ui/networkmgr.lua | 13 ++----------- frontend/ui/otamanager.lua | 2 ++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a4c436996..2316b7a5c 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,9 @@ pbupdate: all $(INSTALL_DIR)/applications/koreader/ota/package.index echo "applications/koreader/ota/package.index" >> \ $(INSTALL_DIR)/applications/koreader/ota/package.index + # hack file path when running tar in parent directory of koreader + sed -i -e 's/^/..\//' \ + $(INSTALL_DIR)/applications/koreader/ota/package.index # update index file in zip package cd $(INSTALL_DIR) && zip -u ../koreader-pocketbook-$(MACHINE)-$(VERSION).zip \ applications/koreader/ota/package.index diff --git a/frontend/ui/elements/common_info_menu_table.lua b/frontend/ui/elements/common_info_menu_table.lua index 987abf4b0..7b1ff9d7a 100644 --- a/frontend/ui/elements/common_info_menu_table.lua +++ b/frontend/ui/elements/common_info_menu_table.lua @@ -5,7 +5,7 @@ local _ = require("gettext") local common_info = {} -if Device:isKindle() or Device:isKobo() then +if Device:isKindle() or Device:isKobo() or Device:isPocketBook() then local OTAManager = require("ui/otamanager") table.insert(common_info, OTAManager:getOTAMenuTable()) end diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua index b9adcee08..ea55b2d01 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -73,17 +73,8 @@ function NetworkMgr:promptWifiOff() end function NetworkMgr:getWifiStatus() - local default_string = io.popen("ip r | grep default") - if not default_string then return false end - local result = default_string:read() - default_string:close() - if result ~= nil then - local gateway = string.match(result,"%d+.%d+.%d+.%d+") - if gateway and os.execute("ping -q -c1 "..gateway) == 0 then - return true - end -- ping to gateway - end -- test for empty string - return false + local socket = require("socket") + return socket.dns.toip("www.google.com") ~= nil end function NetworkMgr:setHTTPProxy(proxy) diff --git a/frontend/ui/otamanager.lua b/frontend/ui/otamanager.lua index cb857ebf0..241bddb85 100644 --- a/frontend/ui/otamanager.lua +++ b/frontend/ui/otamanager.lua @@ -28,6 +28,8 @@ function OTAManager:getOTAModel() return "kindle" elseif Device:isKobo() then return "kobo" + elseif Device:isPocketBook() then + return "pocketbook" else return "" end