diff --git a/frontend/apps/filemanager/filemanagermenu.lua b/frontend/apps/filemanager/filemanagermenu.lua index e7add1358..3f0c55de8 100644 --- a/frontend/apps/filemanager/filemanagermenu.lua +++ b/frontend/apps/filemanager/filemanagermenu.lua @@ -451,8 +451,8 @@ To: end, }) end - --- @note Currently, only Kobo has a fancy crash display (#5328) - if Device:isKobo() then + --- @note Currently, only Kobo, rM & PB have a fancy crash display (#5328) + if Device:isKobo() or Device:isRemarkable() or Device:isPocketBook() then table.insert(self.menu_items.developer_options.sub_item_table, { text = _("Always abort on crash"), checked_func = function() @@ -522,6 +522,35 @@ To: end, }) end + --- @note: Currently, only Kobo implements this quirk + if Device:hasEinkScreen() and Device:isKobo() then + table.insert(self.menu_items.developer_options.sub_item_table, { + -- @translators Highly technical (ioctl is a Linux API call, the uppercase stuff is a constant). What's translatable is essentially only the action ("bypass") and the article. + text = _("Bypass the MXCFB_WAIT_FOR_* ioctls"), + checked_func = function() + local mxcfb_bypass_wait_for + if G_reader_settings:has("mxcfb_bypass_wait_for") then + mxcfb_bypass_wait_for = G_reader_settings:isTrue("mxcfb_bypass_wait_for") + else + mxcfb_bypass_wait_for = not Device:hasReliableMxcWaitFor() + end + return mxcfb_bypass_wait_for + end, + callback = function() + local mxcfb_bypass_wait_for + if G_reader_settings:has("mxcfb_bypass_wait_for") then + mxcfb_bypass_wait_for = G_reader_settings:isTrue("mxcfb_bypass_wait_for") + else + mxcfb_bypass_wait_for = not Device:hasReliableMxcWaitFor() + end + G_reader_settings:saveSetting("mxcfb_bypass_wait_for", not mxcfb_bypass_wait_for) + local InfoMessage = require("ui/widget/infomessage") + UIManager:show(InfoMessage:new{ + text = _("This will take effect on next restart."), + }) + end, + }) + end if Device:isAndroid() then table.insert(self.menu_items.developer_options.sub_item_table, { text = _("Start E-ink test"), diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index d683fef00..84bfae005 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -49,6 +49,8 @@ local Kobo = Generic:new{ canHWInvert = yes, home_dir = "/mnt/onboard", canToggleMassStorage = yes, + -- MXCFB_WAIT_FOR_UPDATE_COMPLETE ioctls are generally reliable + hasReliableMxcWaitFor = yes, } --- @todo hasKeys for some devices? @@ -259,6 +261,12 @@ local KoboStorm = Kobo:new{ nl_max = 10, nl_inverted = true, }, + -- NOTE: The Libra apparently suffers from a mysterious issue where completely innocuous WAIT_FOR_UPDATE_COMPLETE ioctls + -- will mysteriously fail with a timeout (5s)... + -- This obviously leads to *terrible* user experience, so, until more is understood avout the issue, + -- bypass this ioctl on this device. + -- c.f., https://github.com/koreader/koreader/issues/7340 + hasReliableMxcWaitFor = no, } -- Kobo Nia: @@ -272,7 +280,20 @@ local KoboLuna = Kobo:new{ } function Kobo:init() - self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg, is_always_portrait = self.isAlwaysPortrait()} + -- Check if we need to disable MXCFB_WAIT_FOR_UPDATE_COMPLETE ioctls... + local mxcfb_bypass_wait_for + if G_reader_settings:has("mxcfb_bypass_wait_for") then + mxcfb_bypass_wait_for = G_reader_settings:isTrue("mxcfb_bypass_wait_for") + else + mxcfb_bypass_wait_for = not self:hasReliableMxcWaitFor() + end + + self.screen = require("ffi/framebuffer_mxcfb"):new{ + device = self, + debug = logger.dbg, + is_always_portrait = self.isAlwaysPortrait(), + mxcfb_bypass_wait_for = mxcfb_bypass_wait_for, + } if self.screen.fb_bpp == 32 then -- Ensure we decode images properly, as our framebuffer is BGRA... logger.info("Enabling Kobo @ 32bpp BGR tweaks")