A round of Kindle fixes (#3955)

* Refresh Kindle model ID routines

* Pickup current OTA packages

We stopped shipping files w/ the full .tar.gz extension a looooong time
ago.

* And actually generally handle current packages properly

* Kindle screensaver handling experiment

WIP, because there's a fair bit of insanity left in there.
Namely, USBMS is anathema. We simply shouldn't do that, at all,
but the system allows us to do it and basically shoot ourselves in the
head one way or another.

* Don't try to handle the insanity that would be USBMS on Kindles

* Yay, one less thing to worry about :).

* Okay, that should be much saner...

Since the whole deal w/ letting the WM handle stuff was for SO, restrict
that to SO devices.
The other concern was USBMS, but we can't support it.

* Reword that

* And move that comment inside the branch, like its counterpart
pull/3956/head
NiLuJe 6 years ago committed by GitHub
parent ebf47771d8
commit 68c1246575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -83,56 +83,54 @@ function Kindle:setDateTime(year, month, day, hour, min, sec)
end end
function Kindle:usbPlugIn() function Kindle:usbPlugIn()
if self.charging_mode == false and self.screen_saver_mode == false then -- NOTE: We do NOT support running in USBMS mode (we cannot, we live there).
-- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... -- And, AFAICT, we have no sane way of disabling USBMS mode without breaking either us or the framework,
if os.getenv("AWESOME_STOPPED") == "yes" then -- c.f., https://github.com/koreader/koreader/issues/3220
os.execute("killall -cont awesome") -- That means shit will blow up in fun and interesting ways if someone actually tries that.
end -- On the upside, we don't have to bother waking up the WM to show us the USBMS screen :D.
end -- NOTE: If the device is put in USBNet mode before we even start, everything's peachy, though :).
self.charging_mode = true self.charging_mode = true
end end
function Kindle:intoScreenSaver() function Kindle:intoScreenSaver()
local Screensaver = require("ui/screensaver") local Screensaver = require("ui/screensaver")
if self:supportsScreensaver() then if self:supportsScreensaver() then
Screensaver:show() -- NOTE: Meaning this is not a SO device ;)
end if self.screen_saver_mode == false then
self.powerd:beforeSuspend() Screensaver:show()
if self.charging_mode == false and self.screen_saver_mode == false then end
self.screen_saver_mode = true else
-- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... -- Let the native system handle screensavers on SO devices...
if os.getenv("AWESOME_STOPPED") == "yes" then if self.screen_saver_mode == false then
os.execute("killall -cont awesome") if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -cont awesome")
end
end end
end end
self.powerd:beforeSuspend()
self.screen_saver_mode = true
end end
function Kindle:outofScreenSaver() function Kindle:outofScreenSaver()
if self.screen_saver_mode == true and self.charging_mode == false then if self.screen_saver_mode == true then
-- On FW >= 5.7.2, put awesome to sleep again...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -stop awesome")
end
local Screensaver = require("ui/screensaver") local Screensaver = require("ui/screensaver")
if self:supportsScreensaver() then if self:supportsScreensaver() then
Screensaver:close() Screensaver:close()
else
-- Stop awesome again if need be...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -stop awesome")
end
end end
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end) UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end end
self.screen_saver_mode = false
self.powerd:afterResume() self.powerd:afterResume()
self.screen_saver_mode = false
end end
function Kindle:usbPlugOut() function Kindle:usbPlugOut()
if self.charging_mode == true and self.screen_saver_mode == false then -- NOTE: See usbPlugIn(), we don't have anything fancy to do here either.
-- On FW >= 5.7.2, put awesome to sleep again...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -stop awesome")
end
local UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end
--@TODO signal filemanager for file changes 13.06 2012 (houqp) --@TODO signal filemanager for file changes 13.06 2012 (houqp)
self.charging_mode = false self.charging_mode = false
@ -590,7 +588,8 @@ local kindle_devcode = string.sub(kindle_sn,3,4)
local kindle_devcode_v2 = string.sub(kindle_sn,4,6) local kindle_devcode_v2 = string.sub(kindle_sn,4,6)
-- NOTE: Update me when new devices come out :) -- NOTE: Update me when new devices come out :)
-- Also refer to https://wiki.mobileread.com/wiki/Kindle_Serial_Numbers -- c.f., https://wiki.mobileread.com/wiki/Kindle_Serial_Numbers for identified variants
-- c.f., https://github.com/NiLuJe/KindleTool/blob/master/KindleTool/kindle_tool.h#L174 for all variants
local k2_set = Set { "02", "03" } local k2_set = Set { "02", "03" }
local dx_set = Set { "04", "05" } local dx_set = Set { "04", "05" }
local dxg_set = Set { "09" } local dxg_set = Set { "09" }
@ -605,7 +604,8 @@ local kv_set = Set { "13", "54", "2A", "4F", "52", "53" }
local pw3_set = Set { "0G1", "0G2", "0G4", "0G5", "0G6", "0G7", local pw3_set = Set { "0G1", "0G2", "0G4", "0G5", "0G6", "0G7",
"0KB", "0KC", "0KD", "0KE", "0KF", "0KG", "0LK", "0LL" } "0KB", "0KC", "0KD", "0KE", "0KF", "0KG", "0LK", "0LL" }
local koa_set = Set { "0GC", "0GD", "0GR", "0GS", "0GT", "0GU" } local koa_set = Set { "0GC", "0GD", "0GR", "0GS", "0GT", "0GU" }
local koa2_set = Set { "0P8", "0S1", "0SA" } local koa2_set = Set { "0LM", "0LN", "0LP", "0LQ", "0P1", "0P2", "0P6",
"0P7", "0P8", "0S1", "0S2", "0S3", "0S4", "0S7", "0SA" }
local kt3_set = Set { "0DU", "0K9", "0KA" } local kt3_set = Set { "0DU", "0K9", "0KA" }
if k2_set[kindle_devcode] then if k2_set[kindle_devcode] then

@ -42,7 +42,7 @@ update_koreader() {
found_koreader_package="false" found_koreader_package="false"
# Try to find a koreader package... Behavior undefined if there are multiple packages... # Try to find a koreader package... Behavior undefined if there are multiple packages...
for file in /mnt/us/koreader-kindle-*.tar.gz; do for file in /mnt/us/koreader-kindle-*.targz; do
if [ -f "${file}" ]; then if [ -f "${file}" ]; then
found_koreader_package="${file}" found_koreader_package="${file}"
koreader_pkg_type="tgz" koreader_pkg_type="tgz"
@ -67,12 +67,10 @@ update_koreader() {
fi fi
# Get the version of the package... # Get the version of the package...
if [ "${koreader_pkg_type}" = "tgz" ]; then koreader_pkg_ver="${found_koreader_package%.*}"
koreader_pkg_ver="${found_koreader_package%.*.*}"
else
koreader_pkg_ver="${found_koreader_package%.*}"
fi
koreader_pkg_ver="${koreader_pkg_ver#*-v}" koreader_pkg_ver="${koreader_pkg_ver#*-v}"
# Strip the date purely because of screen space constraints
koreader_pkg_ver="${koreader_pkg_ver%_*}"
# Install it! # Install it!
logmsg "Updating to KOReader ${koreader_pkg_ver} . . ." logmsg "Updating to KOReader ${koreader_pkg_ver} . . ."
if [ "${koreader_pkg_type}" = "tgz" ]; then if [ "${koreader_pkg_type}" = "tgz" ]; then

@ -18,21 +18,21 @@ fi
kmodel="$(cut -c3-4 /proc/usid)" kmodel="$(cut -c3-4 /proc/usid)"
case "${kmodel}" in case "${kmodel}" in
"13" | "54" | "2A" | "4F" | "52" | "53") "13" | "54" | "2A" | "4F" | "52" | "53")
# Voyage... # Voyage
SCREEN_X_RES=1088 # NOTE: Yes, 1088, not 1072 or 1080... SCREEN_X_RES=1088 # NOTE: Yes, 1088, not 1072 or 1080...
SCREEN_Y_RES=1448 SCREEN_Y_RES=1448
EIPS_X_RES=16 EIPS_X_RES=16
EIPS_Y_RES=24 # Manually mesured, should be accurate. 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") "24" | "1B" | "1D" | "1F" | "1C" | "20" | "D4" | "5A" | "D5" | "D6" | "D7" | "D8" | "F2" | "17" | "60" | "F4" | "F9" | "62" | "61" | "5F")
# PaperWhite... # PaperWhite & PaperWhite 2
SCREEN_X_RES=768 # NOTE: Yes, 768, not 758... SCREEN_X_RES=768 # NOTE: Yes, 768, not 758...
SCREEN_Y_RES=1024 SCREEN_Y_RES=1024
EIPS_X_RES=16 EIPS_X_RES=16
EIPS_Y_RES=24 # Manually mesured, should be accurate. EIPS_Y_RES=24 # Manually mesured, should be accurate.
;; ;;
"C6" | "DD") "C6" | "DD")
# KT2... # KT2
SCREEN_X_RES=608 SCREEN_X_RES=608
SCREEN_Y_RES=800 SCREEN_Y_RES=800
EIPS_X_RES=16 EIPS_X_RES=16
@ -56,26 +56,28 @@ case "${kmodel}" in
kmodel="$(cut -c4-6 /proc/usid)" kmodel="$(cut -c4-6 /proc/usid)"
case "${kmodel}" in case "${kmodel}" in
"0G1" | "0G2" | "0G4" | "0G5" | "0G6" | "0G7" | "0KB" | "0KC" | "0KD" | "0KE" | "0KF" | "0KG" | "0LK" | "0LL") "0G1" | "0G2" | "0G4" | "0G5" | "0G6" | "0G7" | "0KB" | "0KC" | "0KD" | "0KE" | "0KF" | "0KG" | "0LK" | "0LL")
# PW3... NOTE: Hopefully matches the KV... # PW3
SCREEN_X_RES=1088 SCREEN_X_RES=1088
SCREEN_Y_RES=1448 SCREEN_Y_RES=1448
EIPS_X_RES=16 EIPS_X_RES=16
EIPS_Y_RES=24 EIPS_Y_RES=24
;; ;;
"0GC" | "0GD" | "0GP" | "0GQ" | "0GR" | "0GS") "0GC" | "0GD" | "0GR" | "0GS" | "0GT" | "0GU")
# Oasis... NOTE: Hopefully matches the KV... # Oasis
SCREEN_X_RES=1088 SCREEN_X_RES=1088
SCREEN_Y_RES=1448 SCREEN_Y_RES=1448
EIPS_X_RES=16 EIPS_X_RES=16
EIPS_Y_RES=24 EIPS_Y_RES=24
;; ;;
"0P8" | "0S1" | "0SA") "0LM" | "0LN" | "0LP" | "0LQ" | "0P1" | "0P2" | "0P6" | "0P7" | "0P8" | "0S1" | "0S2" | "0S3" | "0S4" | "0S7" | "0SA")
# Oasis 2 # Oasis 2
SCREEN_X_RES=1264 SCREEN_X_RES=1280 # NOTE: Yep, line_length/xres_virtual, not xres (1264)
SCREEN_Y_RES=1680 SCREEN_Y_RES=1680
EIPS_X_RES=16 # TBD 19?
EIPS_Y_RES=24 # TBD 28? 25?!
;; ;;
"0DT" | "0K9" | "0KA") "0DU" | "0K9" | "0KA")
# KT3... NOTE: Hopefully matches the KT2... # KT3
SCREEN_X_RES=608 SCREEN_X_RES=608
SCREEN_Y_RES=800 SCREEN_Y_RES=800
EIPS_X_RES=16 EIPS_X_RES=16

Loading…
Cancel
Save