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
function Kindle:usbPlugIn()
if self.charging_mode == false and self.screen_saver_mode == false then
-- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -cont awesome")
end
end
-- NOTE: We do NOT support running in USBMS mode (we cannot, we live there).
-- And, AFAICT, we have no sane way of disabling USBMS mode without breaking either us or the framework,
-- c.f., https://github.com/koreader/koreader/issues/3220
-- That means shit will blow up in fun and interesting ways if someone actually tries that.
-- On the upside, we don't have to bother waking up the WM to show us the USBMS screen :D.
-- NOTE: If the device is put in USBNet mode before we even start, everything's peachy, though :).
self.charging_mode = true
end
function Kindle:intoScreenSaver()
local Screensaver = require("ui/screensaver")
if self:supportsScreensaver() then
Screensaver:show()
end
self.powerd:beforeSuspend()
if self.charging_mode == false and self.screen_saver_mode == false then
self.screen_saver_mode = true
-- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -cont awesome")
-- NOTE: Meaning this is not a SO device ;)
if self.screen_saver_mode == false then
Screensaver:show()
end
else
-- Let the native system handle screensavers on SO devices...
if self.screen_saver_mode == false then
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -cont awesome")
end
end
end
self.powerd:beforeSuspend()
self.screen_saver_mode = true
end
function Kindle:outofScreenSaver()
if self.screen_saver_mode == true and self.charging_mode == false then
-- On FW >= 5.7.2, put awesome to sleep again...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -stop awesome")
end
if self.screen_saver_mode == true then
local Screensaver = require("ui/screensaver")
if self:supportsScreensaver() then
Screensaver:close()
else
-- Stop awesome again if need be...
if os.getenv("AWESOME_STOPPED") == "yes" then
os.execute("killall -stop awesome")
end
end
local UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end
self.screen_saver_mode = false
self.powerd:afterResume()
self.screen_saver_mode = false
end
function Kindle:usbPlugOut()
if self.charging_mode == true and self.screen_saver_mode == false 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 UIManager = require("ui/uimanager")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end
-- NOTE: See usbPlugIn(), we don't have anything fancy to do here either.
--@TODO signal filemanager for file changes 13.06 2012 (houqp)
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)
-- 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 dx_set = Set { "04", "05" }
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",
"0KB", "0KC", "0KD", "0KE", "0KF", "0KG", "0LK", "0LL" }
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" }
if k2_set[kindle_devcode] then

@ -42,7 +42,7 @@ update_koreader() {
found_koreader_package="false"
# 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
found_koreader_package="${file}"
koreader_pkg_type="tgz"
@ -67,12 +67,10 @@ update_koreader() {
fi
# Get the version of the package...
if [ "${koreader_pkg_type}" = "tgz" ]; then
koreader_pkg_ver="${found_koreader_package%.*.*}"
else
koreader_pkg_ver="${found_koreader_package%.*}"
fi
koreader_pkg_ver="${found_koreader_package%.*}"
koreader_pkg_ver="${koreader_pkg_ver#*-v}"
# Strip the date purely because of screen space constraints
koreader_pkg_ver="${koreader_pkg_ver%_*}"
# Install it!
logmsg "Updating to KOReader ${koreader_pkg_ver} . . ."
if [ "${koreader_pkg_type}" = "tgz" ]; then

@ -18,21 +18,21 @@ fi
kmodel="$(cut -c3-4 /proc/usid)"
case "${kmodel}" in
"13" | "54" | "2A" | "4F" | "52" | "53")
# Voyage...
# 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...
# PaperWhite & PaperWhite 2
SCREEN_X_RES=768 # NOTE: Yes, 768, not 758...
SCREEN_Y_RES=1024
EIPS_X_RES=16
EIPS_Y_RES=24 # Manually mesured, should be accurate.
;;
"C6" | "DD")
# KT2...
# KT2
SCREEN_X_RES=608
SCREEN_Y_RES=800
EIPS_X_RES=16
@ -56,26 +56,28 @@ case "${kmodel}" in
kmodel="$(cut -c4-6 /proc/usid)"
case "${kmodel}" in
"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_Y_RES=1448
EIPS_X_RES=16
EIPS_Y_RES=24
;;
"0GC" | "0GD" | "0GP" | "0GQ" | "0GR" | "0GS")
# Oasis... NOTE: Hopefully matches the KV...
"0GC" | "0GD" | "0GR" | "0GS" | "0GT" | "0GU")
# Oasis
SCREEN_X_RES=1088
SCREEN_Y_RES=1448
EIPS_X_RES=16
EIPS_Y_RES=24
;;
"0P8" | "0S1" | "0SA")
"0LM" | "0LN" | "0LP" | "0LQ" | "0P1" | "0P2" | "0P6" | "0P7" | "0P8" | "0S1" | "0S2" | "0S3" | "0S4" | "0S7" | "0SA")
# Oasis 2
SCREEN_X_RES=1264
SCREEN_X_RES=1280 # NOTE: Yep, line_length/xres_virtual, not xres (1264)
SCREEN_Y_RES=1680
EIPS_X_RES=16 # TBD 19?
EIPS_Y_RES=24 # TBD 28? 25?!
;;
"0DT" | "0K9" | "0KA")
# KT3... NOTE: Hopefully matches the KT2...
"0DU" | "0K9" | "0KA")
# KT3
SCREEN_X_RES=608
SCREEN_Y_RES=800
EIPS_X_RES=16

Loading…
Cancel
Save