From f8afb56953b4292b03c3202e8ea5ec60972747c6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 4 Sep 2015 23:10:42 +0200 Subject: [PATCH 1/6] Pull updated base for FT fixes --- base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base b/base index fb3847c10..2c5e067ec 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit fb3847c10945e2e8a4c18a9d7c213aaf0834a8c1 +Subproject commit 2c5e067ec8a7c80047f1c5099bec200e52bb885c From 89e8e4297c19ac6815397bd67f097fc635a5c0a5 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 4 Sep 2015 23:11:25 +0200 Subject: [PATCH 2/6] DroidFallbackFull went buh-bye, don't break the recipe by failing so near the end ;). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b542630c4..f028ef115 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ endif ifeq ($(or $(EMULATE_READER),$(WIN32)),) # clean up, remove unused files for releases rm -rf $(INSTALL_DIR)/koreader/data/{cr3.ini,cr3skin-format.txt,desktop,devices,manual} - rm $(INSTALL_DIR)/koreader/fonts/droid/DroidSansFallbackFull.ttf + rm -rf $(INSTALL_DIR)/koreader/fonts/droid/DroidSansFallbackFull.ttf endif $(KOR_BASE)/$(OUTPUT_DIR)/luajit: From 687aba796dc268fc7fae5742a1b2620a5f6fd421 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 4 Sep 2015 23:14:17 +0200 Subject: [PATCH 3/6] Fix networkmgr on Kobo To avoid potential issues with USBMS. Namely, make sure CWD doesn't point to the userstore for persitent processes. Make sure wpa_supplicant doesn't try to use our own OpenSSL lib, which, again, is in the userstore area. Properly kill our dhcp client invocation on when killing WiFi Also, some related fixes to the startup script: Properly kill wpa_supplicant & the dhcp client when we kill wifi before rebooting to nickel. --- frontend/ui/networkmgr.lua | 6 +++--- platform/kobo/nickel.sh | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua index 81f4d578e..ea879bc2d 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -26,11 +26,11 @@ local function koboEnableWifi(toggle) os.execute("sleep 2") os.execute("ifconfig eth0 up") os.execute("wlarm_le -i eth0 up") - os.execute("pidof wpa_supplicant >/dev/null || wpa_supplicant -s -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B") + os.execute("pidof wpa_supplicant >/dev/null || cd / && env -u LD_LIBRARY_PATH wpa_supplicant -s -i eth0 -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B") os.execute("sleep 1") - os.execute("/sbin/udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1 &") + os.execute("cd / && env -u LD_LIBRARY_PATH /sbin/udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1 &") else - os.execute("killall udhcpc wpa_supplicant 2>/dev/null") + os.execute("killall udhcpc default.script wpa_supplicant 2>/dev/null") os.execute("wlarm_le -i eth0 down") os.execute("ifconfig eth0 down") os.execute("rmmod -r dhd") diff --git a/platform/kobo/nickel.sh b/platform/kobo/nickel.sh index 6096c220f..ca1c9d01b 100644 --- a/platform/kobo/nickel.sh +++ b/platform/kobo/nickel.sh @@ -29,6 +29,7 @@ export LANG="en_US.UTF-8" # Make sure we kill the WiFi first, because nickel apparently doesn't like it if it's up... (cf. #1520) # NOTE: That check is possibly wrong on PLATFORM == freescale (because I don't know if the sdio_wifi_pwr module exists there), but we don't terribly care about that. if lsmod | grep -q sdio_wifi_pwr ; then + killall udhcpc default.script wpa_supplicant 2>/dev/null wlarm_le -i ${INTERFACE} down ifconfig ${INTERFACE} down # NOTE: Kobo's busybox build is weird. rmmod appears to be modprobe in disguise, defaulting to the -r flag. If re-specifying -r starts to fail one day, switch to rmmod without args, or modprobe -r. From e56add5f078f5d4d48ce7d79ae13810dc98cf159 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 4 Sep 2015 23:18:14 +0200 Subject: [PATCH 4/6] Pull fixed base -_-" --- base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base b/base index 2c5e067ec..79fd20a2f 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 2c5e067ec8a7c80047f1c5099bec200e52bb885c +Subproject commit 79fd20a2fed8bec424338a0c610a82abf47efd21 From 985cd1b6d9aa853dc3fa26d1db674b866f435e47 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 4 Sep 2015 23:57:57 +0200 Subject: [PATCH 5/6] Pull updated base for FT buildfix --- base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base b/base index 79fd20a2f..1052bd1d5 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 79fd20a2fed8bec424338a0c610a82abf47efd21 +Subproject commit 1052bd1d58a76a116e196a2d13ed80c283e91dde From a4ebfee83b0e079edd8d9e326f07760a744f373b Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 5 Sep 2015 03:33:11 +0200 Subject: [PATCH 6/6] Handle the PW3 (Dry-coded, assume it's basically a PW2 w/ the KV screen ;p) --- base | 2 +- .../modules/readeractivityindicator.lua | 2 +- frontend/device/kindle/device.lua | 28 +++++++++++ platform/kindle/libkohelper.sh | 46 +++++++++++++------ 4 files changed, 63 insertions(+), 15 deletions(-) diff --git a/base b/base index 1052bd1d5..c26c3ddca 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 1052bd1d58a76a116e196a2d13ed80c283e91dde +Subproject commit c26c3ddca2671e3e2978cbd41388c316a3769042 diff --git a/frontend/apps/reader/modules/readeractivityindicator.lua b/frontend/apps/reader/modules/readeractivityindicator.lua index 27237e82d..cd2caced8 100644 --- a/frontend/apps/reader/modules/readeractivityindicator.lua +++ b/frontend/apps/reader/modules/readeractivityindicator.lua @@ -7,7 +7,7 @@ local ReaderActivityIndicator = EventListener:new{} function ReaderActivityIndicator:init() local dev_mod = Device.model - if dev_mod == "KindlePaperWhite" or dev_mod == "KindlePaperWhite2" or dev_mod == "KindleVoyage" or dev_mod == "KindleBasic" or dev_mod == "KindleTouch" then + if dev_mod == "KindlePaperWhite" or dev_mod == "KindlePaperWhite2" or dev_mod == "KindleVoyage" or dev_mod == "KindleBasic" or dev_mod == "KindlePaperWhite3" or dev_mod == "KindleTouch" then if (pcall(require, "liblipclua")) then self.lipc_handle = lipc.init("com.github.koreader.activityindicator") end diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index 6c611085d..4ecbd9289 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -69,6 +69,14 @@ local KindleVoyage = Kindle:new{ touch_dev = "/dev/input/event1", } +local KindlePaperWhite3 = Kindle:new{ + model = "KindlePaperWhite3", + isTouchDevice = yes, + hasFrontlight = yes, + display_dpi = 300, + touch_dev = "/dev/input/event1", +} + function Kindle2:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = DEBUG} self.input = require("device/input"):new{ @@ -205,6 +213,21 @@ function KindleVoyage:init() self.input.open("fake_events") end +function KindlePaperWhite3:init() + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} + self.powerd = require("device/kindle/powerd"):new{ + device = self, + fl_intensity_file = "/sys/class/backlight/max77696-bl/brightness", + batt_capacity_file = "/sys/devices/system/wario_battery/wario_battery0/battery_capacity", + is_charging_file = "/sys/devices/system/wario_charger/wario_charger0/charging", + } + + Kindle.init(self) + + self.input.open("/dev/input/event1") + self.input.open("fake_events") +end + --[[ Test if a kindle device has Special Offers --]] @@ -246,6 +269,7 @@ KindlePaperWhite.exit = KindleTouch.exit KindlePaperWhite2.exit = KindleTouch.exit KindleBasic.exit = KindleTouch.exit KindleVoyage.exit = KindleTouch.exit +KindlePaperWhite3.exit = KindleTouch.exit function Kindle3:exit() -- send double menu key press events to trigger screen refresh @@ -269,6 +293,7 @@ end local kindle_sn = io.open("/proc/usid", "r") if not kindle_sn then return end local kindle_devcode = string.sub(kindle_sn:read(),3,4) +local kindle_devcode_v2 = string.sub(kindle_sn:read(),4,6) kindle_sn:close() -- NOTE: Update me when new devices come out :) @@ -283,6 +308,7 @@ local pw2_set = Set { "D4", "5A", "D5", "D6", "D7", "D8", "F2", "17", "60", "F4", "F9", "62", "61", "5F" } local kt2_set = Set { "C6", "DD" } local kv_set = Set { "13", "54", "2A", "4F", "52", "53" } +local pw3_set = Set { "0G1", "0G2", "0G4", "0G5", "0G6", "0G7" } if k2_set[kindle_devcode] then return Kindle2 @@ -304,6 +330,8 @@ elseif kt2_set[kindle_devcode] then return KindleBasic elseif kv_set[kindle_devcode] then return KindleVoyage +elseif pw3_set[kindle_devcode_v2] then + return KindlePaperWhite3 end error("unknown Kindle model "..kindle_devcode) diff --git a/platform/kindle/libkohelper.sh b/platform/kindle/libkohelper.sh index 8604d3fa8..5ce404b60 100644 --- a/platform/kindle/libkohelper.sh +++ b/platform/kindle/libkohelper.sh @@ -15,6 +15,13 @@ fi # We need to get the proper constants for our model... kmodel="$(cut -c3-4 /proc/usid)" case "${kmodel}" in + "13" | "54" | "2A" | "4F" | "52" | "53" ) + # Voyage... + SCREEN_X_RES=1088 # NOTE: Yes, 1088, not 1072 or 1080... + SCREEN_Y_RES=1448 + EIPS_X_RES=16 + EIPS_Y_RES=24 # Manually mesured, should be accurate. + ;; "24" | "1B" | "1D" | "1F" | "1C" | "20" | "D4" | "5A" | "D5" | "D6" | "D7" | "D8" | "F2" | "17" | "60" | "F4" | "F9" | "62" | "61" | "5F" ) # PaperWhite... SCREEN_X_RES=768 # NOTE: Yes, 768, not 758... @@ -22,20 +29,20 @@ case "${kmodel}" in EIPS_X_RES=16 EIPS_Y_RES=24 # Manually mesured, should be accurate. ;; - "13" | "54" | "2A" | "4F" | "52" | "53" ) - # Kindle Voyage - SCREEN_X_RES=1088 # NOTE: Yes, 1088, not 1072 or 1080... - SCREEN_Y_RES=1448 - EIPS_X_RES=16 - EIPS_Y_RES=24 # Manually mesured, should be accurate. - ;; "C6" | "DD" ) # KT2... - SCREEN_X_RES=608 # NOTE: Might actually be 600... + SCREEN_X_RES=608 SCREEN_Y_RES=800 EIPS_X_RES=16 EIPS_Y_RES=24 ;; + "0F" | "11" | "10" | "12" ) + # Touch + SCREEN_X_RES=600 # _v_width @ upstart/functions + SCREEN_Y_RES=800 # _v_height @ upstart/functions + EIPS_X_RES=12 # from f_puts @ upstart/functions + EIPS_Y_RES=20 # from f_puts @ upstart/functions + ;; * ) # Handle legacy devices... if [ -f "/etc/rc.d/functions" ] && grep "EIPS" "/etc/rc.d/functions" > /dev/null 2>&1 ; then @@ -43,11 +50,24 @@ case "${kmodel}" in #. /etc/rc.d/functions echo "foo" >/dev/null else - # Touch - SCREEN_X_RES=600 # _v_width @ upstart/functions - SCREEN_Y_RES=800 # _v_height @ upstart/functions - EIPS_X_RES=12 # from f_puts @ upstart/functions - EIPS_Y_RES=20 # from f_puts @ upstart/functions + # Try the new device ID scheme... + kmodel="$(cut -c4-6 /proc/usid)" + case "${kmodel}" in + "0G1" | "0G2" | "0G4" | "0G5" | "0G6" | "0G7" ) + # PW3... NOTE: Hopefully matches the KV... + SCREEN_X_RES=1088 + SCREEN_Y_RES=1448 + EIPS_X_RES=16 + EIPS_Y_RES=24 + ;; + * ) + # Fallback... We shouldn't ever hit that. + SCREEN_X_RES=600 + SCREEN_Y_RES=800 + EIPS_X_RES=12 + EIPS_Y_RES=20 + ;; + esac fi ;; esac