mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Support the Kindle PW4 (#4324)
* Fix version checks on FW >= 5.10.x * Bump base
This commit is contained in:
2
base
2
base
Submodule base updated: b027efb11a...6b5849fe28
@@ -263,6 +263,14 @@ local KindleBasic2 = Kindle:new{
|
||||
touch_dev = "/dev/input/event0",
|
||||
}
|
||||
|
||||
local KindlePaperWhite4 = Kindle:new{
|
||||
model = "KindlePaperWhite4",
|
||||
isTouchDevice = yes,
|
||||
hasFrontlight = yes,
|
||||
display_dpi = 300,
|
||||
touch_dev = "/dev/input/event2",
|
||||
}
|
||||
|
||||
function Kindle2:init()
|
||||
self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = logger.dbg}
|
||||
self.powerd = require("device/kindle/powerd"):new{
|
||||
@@ -623,6 +631,22 @@ function KindleBasic2:init()
|
||||
self.input.open("fake_events")
|
||||
end
|
||||
|
||||
-- NOTE: FrontLight might be wrong, TBC!
|
||||
function KindlePaperWhite4:init()
|
||||
self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg}
|
||||
self.powerd = require("device/kindle/powerd"):new{
|
||||
device = self,
|
||||
fl_intensity_file = "/sys/class/backlight/max77696-bl/brightness",
|
||||
batt_capacity_file = "/sys/class/power_supply/bd71827_bat/capacity",
|
||||
is_charging_file = "/sys/class/power_supply/bd71827_bat/charging",
|
||||
}
|
||||
|
||||
Kindle.init(self)
|
||||
|
||||
self.input.open(self.touch_dev)
|
||||
self.input.open("fake_events")
|
||||
end
|
||||
|
||||
function KindleTouch:exit()
|
||||
Generic.exit(self)
|
||||
if self.isSpecialOffers then
|
||||
@@ -648,6 +672,7 @@ KindlePaperWhite3.exit = KindleTouch.exit
|
||||
KindleOasis.exit = KindleTouch.exit
|
||||
KindleOasis2.exit = KindleTouch.exit
|
||||
KindleBasic2.exit = KindleTouch.exit
|
||||
KindlePaperWhite4.exit = KindleTouch.exit
|
||||
|
||||
function Kindle3:exit()
|
||||
-- send double menu key press events to trigger screen refresh
|
||||
@@ -695,6 +720,8 @@ local koa_set = Set { "0GC", "0GD", "0GR", "0GS", "0GT", "0GU" }
|
||||
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 pw4_set = Set { "0PP", "0T1", "0T2", "0T3", "0T4", "0T5", "0T6",
|
||||
"0T7", "0TJ", "0TK", "0TL", "0TM", "0TN"}
|
||||
|
||||
if k2_set[kindle_devcode] then
|
||||
return Kindle2
|
||||
@@ -724,6 +751,8 @@ elseif koa2_set[kindle_devcode_v2] then
|
||||
return KindleOasis2
|
||||
elseif kt3_set[kindle_devcode_v2] then
|
||||
return KindleBasic2
|
||||
elseif pw4_set[kindle_devcode_v2] then
|
||||
return KindlePaperWhite4
|
||||
end
|
||||
|
||||
error("unknown Kindle model "..kindle_devcode.." ("..kindle_devcode_v2..")")
|
||||
|
||||
@@ -183,6 +183,10 @@ if [ "${STOP_FRAMEWORK}" = "yes" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Normalize a version string for easy numeric comparisons
|
||||
# c.f., https://stackoverflow.com/a/37939589
|
||||
version() { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
|
||||
|
||||
# check if kpvbooklet was launched more than once, if not we will disable pillow
|
||||
# there's no pillow if we stopped the framework, and it's only there on systems with upstart anyway
|
||||
if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "upstart" ]; then
|
||||
@@ -190,16 +194,16 @@ if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "upstart" ]; then
|
||||
if [ "$count" = "" ] || [ "$count" = "0" ]; then
|
||||
# NOTE: Dump the fb so we can restore something useful on exit...
|
||||
cat /dev/fb0 >/var/tmp/koreader-fb.dump
|
||||
# We're going to need our current FW version...
|
||||
FW_VERSION="$(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:]\.]*)(.*?)$/\3/p')"
|
||||
# NOTE: We want to disable the status bar (at the very least). Unfortunately, the soft hide/unhide method doesn't work properly anymore since FW 5.6.5...
|
||||
# shellcheck disable=SC2046
|
||||
if [ "$(printf "%.3s" $(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:].]*)(.*?)$/\3/p' | tr -d '.'))" -ge "565" ]; then
|
||||
if [ "$(version "${FW_VERSION}")" -ge "$(version "5.6.5")" ]; then
|
||||
PILLOW_HARD_DISABLED="yes"
|
||||
# FIXME: So we resort to killing pillow completely on FW >= 5.6.5...
|
||||
logmsg "Disabling pillow . . ."
|
||||
lipc-set-prop com.lab126.pillow disableEnablePillow disable
|
||||
# NOTE: And, oh, joy, on FW >= 5.7.2, this is not enough to prevent the clock from refreshing, so, take the bull by the horns, and SIGSTOP the WM while we run...
|
||||
# shellcheck disable=SC2046
|
||||
if [ "$(printf "%.3s" $(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:].]*)(.*?)$/\3/p' | tr -d '.'))" -ge "572" ]; then
|
||||
if [ "$(version "${FW_VERSION}")" -ge "$(version "5.7.2")" ]; then
|
||||
logmsg "Stopping awesome . . ."
|
||||
killall -stop awesome
|
||||
AWESOME_STOPPED="yes"
|
||||
|
||||
Reference in New Issue
Block a user