diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index 287466c79..9b56bc619 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -898,6 +898,11 @@ local function OasisGyroTranslation(this, ev) end function KindleOasis:init() + -- temporarily wake up awesome + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -CONT awesome") + end + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ device = self, @@ -917,12 +922,16 @@ function KindleOasis:init() } } + Kindle.init(self) + + --- @note See comments in KindleOasis2:init() for details. local haslipc, lipc = pcall(require, "liblipclua") if haslipc and lipc then local lipc_handle = lipc.init("com.github.koreader.screen") if lipc_handle then local orientation_code = lipc_handle:get_string_property( "com.lab126.winmgr", "accelerometer") + logger.dbg("orientation_code =", orientation_code) local rotation_mode = 0 if orientation_code then if orientation_code == "U" then @@ -935,17 +944,17 @@ function KindleOasis:init() rotation_mode = self.screen.DEVICE_ROTATED_COUNTER_CLOCKWISE end end - if rotation_mode > 0 then self.screen.native_rotation_mode = rotation_mode - self.screen.cur_rotation_mode = rotation_mode end - + self.screen:setRotationMode(rotation_mode) lipc_handle:close() end end - - Kindle.init(self) + -- put awesome back to sleep + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -STOP awesome") + end self.input:registerEventAdjustHook(OasisGyroTranslation) self.input.handleMiscEv = function(this, ev) @@ -1006,6 +1015,11 @@ local function KindleGyroTransform(this, ev) end function KindleOasis2:init() + -- temporarily wake up awesome + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -CONT awesome") + end + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ device = self, @@ -1025,11 +1039,16 @@ function KindleOasis2:init() } } - --- @fixme When starting KOReader with the device upside down ("D"), touch input is registered wrong + Kindle.init(self) + + --- @note When starting KOReader with the device upside down ("D"), touch input is registered wrong -- (i.e., probably upside down). -- If it's started upright ("U"), everything's okay, and turning it upside down after that works just fine. -- See #2206 & #2209 for the original KOA implementation, which obviously doesn't quite cut it here... -- See also + -- See also #11159 for details about the solution (Kindle Scribe as an example) + -- In regular mode, awesome is woken up for a brief moment for lipc calls. + -- In no-framework mode, this works as is. -- NOTE: It'd take some effort to actually start KOReader while in a LANDSCAPE orientation, -- since they're only exposed inside the stock reader, and not the Home/KUAL Booklets. local haslipc, lipc = pcall(require, "liblipclua") @@ -1038,6 +1057,7 @@ function KindleOasis2:init() if lipc_handle then local orientation_code = lipc_handle:get_string_property( "com.lab126.winmgr", "accelerometer") + logger.dbg("orientation_code =", orientation_code) local rotation_mode = 0 if orientation_code then if orientation_code == "U" then @@ -1050,17 +1070,17 @@ function KindleOasis2:init() rotation_mode = self.screen.DEVICE_ROTATED_COUNTER_CLOCKWISE end end - if rotation_mode > 0 then self.screen.native_rotation_mode = rotation_mode - self.screen.cur_rotation_mode = rotation_mode end - + self.screen:setRotationMode(rotation_mode) lipc_handle:close() end end - - Kindle.init(self) + -- put awesome back to sleep + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -STOP awesome") + end self.input:registerEventAdjustHook(KindleGyroTransform) self.input.handleMiscEv = function(this, ev) @@ -1086,6 +1106,11 @@ function KindleOasis2:init() end function KindleOasis3:init() + -- temporarily wake up awesome + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -CONT awesome") + end + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ device = self, @@ -1106,14 +1131,16 @@ function KindleOasis3:init() } } + Kindle.init(self) - --- @fixme The same quirks as on the Oasis 2 apply ;). + --- @note The same quirks as on the Oasis 2 apply ;). local haslipc, lipc = pcall(require, "liblipclua") if haslipc and lipc then local lipc_handle = lipc.init("com.github.koreader.screen") if lipc_handle then local orientation_code = lipc_handle:get_string_property( "com.lab126.winmgr", "accelerometer") + logger.dbg("orientation_code =", orientation_code) local rotation_mode = 0 if orientation_code then if orientation_code == "U" then @@ -1126,17 +1153,17 @@ function KindleOasis3:init() rotation_mode = self.screen.DEVICE_ROTATED_COUNTER_CLOCKWISE end end - if rotation_mode > 0 then self.screen.native_rotation_mode = rotation_mode - self.screen.cur_rotation_mode = rotation_mode end - + self.screen:setRotationMode(rotation_mode) lipc_handle:close() end end - - Kindle.init(self) + -- put awesome back to sleep + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -STOP awesome") + end self.input:registerEventAdjustHook(KindleGyroTransform) self.input.handleMiscEv = function(this, ev) @@ -1315,6 +1342,7 @@ function KindleScribe:init() if os.getenv("AWESOME_STOPPED") == "yes" then os.execute("killall -CONT awesome") end + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ device = self, @@ -1326,18 +1354,19 @@ function KindleScribe:init() hall_file = "/sys/devices/platform/eink_hall/hall_enable", } + Kindle.init(self) + -- Enable the so-called "fast" mode, so as to prevent the driver from silently promoting refreshes to REAGL. self.screen:_MTK_ToggleFastMode(true) - --- @fixme The same quirks as on the Oasis 2 and 3 apply ;). - -- in regular mode, awesome is woken up for a brief moment. In no-framework mode, this works as is. + --- @note The same quirks as on the Oasis 2 and 3 apply ;). local haslipc, lipc = pcall(require, "liblipclua") if haslipc and lipc then local lipc_handle = lipc.init("com.github.koreader.screen") if lipc_handle then local orientation_code = lipc_handle:get_string_property( "com.lab126.winmgr", "accelerometer") - logger.dbg("orientation_code = ", orientation_code) + logger.dbg("orientation_code =", orientation_code) local rotation_mode = 0 if orientation_code then if orientation_code == "U" then @@ -1350,11 +1379,10 @@ function KindleScribe:init() rotation_mode = self.screen.DEVICE_ROTATED_COUNTER_CLOCKWISE end end - logger.dbg("rotation_mode = ", rotation_mode) if rotation_mode > 0 then self.screen.native_rotation_mode = rotation_mode - self.screen.cur_rotation_mode = rotation_mode end + self.screen:setRotationMode(rotation_mode) lipc_handle:close() end end @@ -1363,8 +1391,6 @@ function KindleScribe:init() os.execute("killall -STOP awesome") end - Kindle.init(self) - -- Setup accelerometer rotation input self.input:registerEventAdjustHook(KindleGyroTransform) self.input.handleMiscEv = function(this, ev)