From b325fa4a5032ba59648b56c6516b709083b69060 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 26 Mar 2021 17:13:27 +0100 Subject: [PATCH] Initial KOA3 support (#7446) * Move MXCFB capchecks to front The fact that this was halfway in front/halfway in base was weird and mistake-prone (c.f., the amount of times I forgot to update one bit or the other). * Initial KOA3 support Assume it's essentially a KOA2. Meaning no warmth handling for now. * Bump base https://github.com/koreader/koreader-base/pull/1339 https://github.com/koreader/koreader-base/pull/1338 --- base | 2 +- frontend/device/kindle/device.lua | 40 +++++++++++++++++++++++++++++++ frontend/device/kobo/device.lua | 19 ++++++++++++--- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/base b/base index 149611e91..1d04e18b8 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 149611e91bac6eb28d27f701794dd4d3fd2b8284 +Subproject commit 1d04e18b8d71172c2783199717e46bba22caf850 diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index e14c9a333..2e7f15fcf 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -109,6 +109,15 @@ local Kindle = Generic:new{ -- NOTE: Newer devices will turn the frontlight off at 0 canTurnFrontlightOff = yes, home_dir = "/mnt/us", + -- New devices are REAGL-aware, default to REAGL + isREAGL = yes, + -- Rex & Zelda devices sport an updated driver. + isZelda = no, + isRex = no, + -- But of course, some devices don't actually support all the features the kernel exposes... + isNightModeChallenged = no, + -- NOTE: While this ought to behave on Zelda/Rex, turns out, nope, it really doesn't work on *any* of 'em :/ (c.f., ko#5884). + canHWDither = no, } function Kindle:initNetworkManager(NetworkMgr) @@ -274,6 +283,7 @@ end local Kindle2 = Kindle:new{ model = "Kindle2", + isREAGL = no, hasKeyboard = yes, hasKeys = yes, hasDPad = yes, @@ -285,6 +295,7 @@ local Kindle2 = Kindle:new{ local KindleDXG = Kindle:new{ model = "KindleDXG", + isREAGL = no, hasKeyboard = yes, hasKeys = yes, hasDPad = yes, @@ -296,6 +307,7 @@ local KindleDXG = Kindle:new{ local Kindle3 = Kindle:new{ model = "Kindle3", + isREAGL = no, hasKeyboard = yes, hasKeys = yes, hasDPad = yes, @@ -306,6 +318,7 @@ local Kindle3 = Kindle:new{ local Kindle4 = Kindle:new{ model = "Kindle4", + isREAGL = no, hasKeys = yes, hasDPad = yes, canHWInvert = no, @@ -316,6 +329,7 @@ local Kindle4 = Kindle:new{ local KindleTouch = Kindle:new{ model = "KindleTouch", + isREAGL = no, isTouchDevice = yes, hasKeys = yes, touch_dev = "/dev/input/event3", @@ -323,6 +337,7 @@ local KindleTouch = Kindle:new{ local KindlePaperWhite = Kindle:new{ model = "KindlePaperWhite", + isREAGL = no, isTouchDevice = yes, hasFrontlight = yes, canTurnFrontlightOff = no, @@ -382,6 +397,18 @@ local KindleOasis = Kindle:new{ local KindleOasis2 = Kindle:new{ model = "KindleOasis2", + isZelda = yes, + isTouchDevice = yes, + hasFrontlight = yes, + hasKeys = yes, + hasGSensor = yes, + display_dpi = 300, + touch_dev = "/dev/input/by-path/platform-30a30000.i2c-event", +} + +local KindleOasis3 = Kindle:new{ + model = "KindleOasis3", + isZelda = yes, isTouchDevice = yes, hasFrontlight = yes, hasKeys = yes, @@ -398,6 +425,7 @@ local KindleBasic2 = Kindle:new{ local KindlePaperWhite4 = Kindle:new{ model = "KindlePaperWhite4", + isRex = yes, isTouchDevice = yes, hasFrontlight = yes, display_dpi = 300, @@ -409,6 +437,10 @@ local KindlePaperWhite4 = Kindle:new{ local KindleBasic3 = Kindle:new{ model = "KindleBasic3", + isRex = yes, + -- NOTE: Apparently, the KT4 doesn't actually support the fancy nightmode waveforms, c.f., ko/#5076 + -- It also doesn't handle HW dithering, c.f., base/#1039 + isNightModeChallenged = yes, isTouchDevice = yes, hasFrontlight = yes, touch_dev = "/dev/input/event2", @@ -763,6 +795,10 @@ function KindleOasis2:init() self.input.open("fake_events") end +-- For now, assume that the KOA3 doesn't do anything differently than the KOA2. +--- @fixme: That means, possibly among other things, that frontlight warmth needs to be implemented. +KindleOasis3.init = KindleOasis2.init + function KindleBasic2:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ @@ -845,6 +881,7 @@ KindleOasis2.exit = KindleTouch.exit KindleBasic2.exit = KindleTouch.exit KindlePaperWhite4.exit = KindleTouch.exit KindleBasic3.exit = KindleTouch.exit +KindleOasis3.exit = KindleTouch.exit function Kindle3:exit() -- send double menu key press events to trigger screen refresh @@ -897,6 +934,7 @@ local pw4_set = Set { "0PP", "0T1", "0T2", "0T3", "0T4", "0T5", "0T6", "0T7", "0TJ", "0TK", "0TL", "0TM", "0TN", "102", "103", "16Q", "16R", "16S", "16T", "16U", "16V" } local kt4_set = Set { "10L", "0WF", "0WG", "0WH", "0WJ", "0VB" } +local koa3_set = Set { "11L", "0WQ", "0WP", "0WN", "0WM", "0WL" } if kindle_sn_lead == "B" or kindle_sn_lead == "9" then local kindle_devcode = string.sub(kindle_sn,3,4) @@ -937,6 +975,8 @@ else return KindlePaperWhite4 elseif kt4_set[kindle_devcode_v2] then return KindleBasic3 + elseif koa3_set[kindle_devcode_v2] then + return KindleOasis3 end end diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index 84bfae005..4a5595787 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -40,8 +40,6 @@ local Kobo = Generic:new{ isAlwaysPortrait = yes, -- we don't need an extra refreshFull on resume, thank you very much. needsScreenRefreshAfterResume = no, - -- the internal storage mount point users can write to - internal_storage_mount_point = "/mnt/onboard/", -- currently only the Aura One and Forma have coloured frontlights hasNaturalLight = no, hasNaturalLightMixer = no, @@ -49,6 +47,10 @@ local Kobo = Generic:new{ canHWInvert = yes, home_dir = "/mnt/onboard", canToggleMassStorage = yes, + -- New devices *may* be REAGL-aware, but generally don't expect explicit REAGL requests, default to not. + isREAGL = no, + -- Mark 7 devices sport an updated driver. + isMk7 = no, -- MXCFB_WAIT_FOR_UPDATE_COMPLETE ioctls are generally reliable hasReliableMxcWaitFor = yes, } @@ -125,6 +127,8 @@ local KoboPhoenix = Kobo:new{ display_dpi = 212, -- The bezel covers 10 pixels at the bottom: viewport = Geom:new{x=0, y=0, w=758, h=1014}, + -- NOTE: AFAICT, the Aura was the only one explicitly requiring REAGL requests... + isREAGL = yes, -- NOTE: May have a buggy kernel, according to the nightmode hack... canHWInvert = no, } @@ -148,6 +152,7 @@ local KoboSnow = Kobo:new{ --- @fixme Check if the Clara fix actually helps here... (#4015) local KoboSnowRev2 = Kobo:new{ model = "Kobo_snow_r2", + isMk7 = yes, hasFrontlight = yes, touch_snow_protocol = true, display_dpi = 265, @@ -167,9 +172,9 @@ local KoboStar = Kobo:new{ } -- Kobo Aura second edition, Rev 2: ---- @fixme Confirm that this is accurate? If it is, and matches the Rev1, ditch the special casing. local KoboStarRev2 = Kobo:new{ model = "Kobo_star_r2", + isMk7 = yes, hasFrontlight = yes, touch_phoenix_protocol = true, display_dpi = 212, @@ -194,6 +199,7 @@ local KoboPika = Kobo:new{ -- Kobo Clara HD: local KoboNova = Kobo:new{ model = "Kobo_nova", + isMk7 = yes, canToggleChargingLED = yes, hasFrontlight = yes, touch_snow_protocol = true, @@ -219,6 +225,7 @@ local KoboNova = Kobo:new{ -- There's also a CM_ROTARY_ENABLE command, but which seems to do as much nothing as the STATUS one... local KoboFrost = Kobo:new{ model = "Kobo_frost", + isMk7 = yes, canToggleChargingLED = yes, hasFrontlight = yes, hasKeys = yes, @@ -243,6 +250,7 @@ local KoboFrost = Kobo:new{ -- NOTE: Assume the same quirks as the Forma apply. local KoboStorm = Kobo:new{ model = "Kobo_storm", + isMk7 = yes, canToggleChargingLED = yes, hasFrontlight = yes, hasKeys = yes, @@ -273,6 +281,7 @@ local KoboStorm = Kobo:new{ --- @fixme: Untested, assume it's Clara-ish for now. local KoboLuna = Kobo:new{ model = "Kobo_luna", + isMk7 = yes, canToggleChargingLED = yes, hasFrontlight = yes, touch_snow_protocol = true, @@ -304,6 +313,10 @@ function Kobo:init() if self:hasNaturalLight() and self.frontlight_settings and self.frontlight_settings.frontlight_mixer then self.hasNaturalLightMixer = yes end + -- Ditto + if self:isMk7() then + self.canHWDither = yes + end self.powerd = require("device/kobo/powerd"):new{device = self} -- NOTE: For the Forma, with the buttons on the right, 193 is Top, 194 Bottom.