Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kobo Libra: Bypass WAIT_FOR_UPDATE_COMPLETE ioctls... #1329

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions ffi/framebuffer_mxcfb.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local bit = require("bit")
local ffi = require("ffi")
local ffiUtil = require("ffi/util")
local BB = require("ffi/blitbuffer")
local C = ffi.C

Expand Down Expand Up @@ -231,6 +232,12 @@ local function kindle_mxc_wait_for_update_submission(fb, marker)
return C.ioctl(fb.fd, C.MXCFB_WAIT_FOR_UPDATE_SUBMISSION, ffi.new("uint32_t[1]", marker))
end

-- Stub version that simply sleeps for 1ms
-- This is roughly five times the amount of time a real *NOP* WAIT_FOR_UPDATE_COMPLETE would take.
-- An effective one could block for ~150ms to north of 500ms, depending on the waveform mode of the waited on marker.
local function stub_mxc_wait_for_update_complete()
return ffiUtil.usleep(1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eep. D-:

end

--[[ refresh functions ]]--

Expand Down Expand Up @@ -809,6 +816,14 @@ function framebuffer:init()
-- Nickel sometimes uses DU, but never w/ the MONOCHROME flag, so, do the same.
-- Plus, DU + MONOCHROME + INVERT is much more prone to the Mk. 7 EPDC bug where some/all
-- EPDC flags just randomly go bye-bye...
-- 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,
-- just fake this ioctl by sleeping for a tiny amount of time instead... :/.
-- c.f., https://github.com/koreader/koreader/issues/7340
if self.device.model == "Kobo_storm" then
self.mech_wait_update_complete = stub_mxc_wait_for_update_complete
end
end
elseif self.device:isPocketBook() then
require("ffi/mxcfb_pocketbook_h")
Expand Down