Skip to content

Instantly share code, notes, and snippets.

@NiLuJe
Last active October 14, 2023 21:22
Show Gist options
  • Save NiLuJe/4be737eb123cf1199590b626be131345 to your computer and use it in GitHub Desktop.
Save NiLuJe/4be737eb123cf1199590b626be131345 to your computer and use it in GitHub Desktop.
KOReader: Disable HW inversion in case it's unreliable (e.g., mxcfb on old ntx kernels).
local Device = require("device")
local Screen = Device.screen
-- Flipping canHWInvert affects what fb:toggleNightmode does, so make sure we flip it with NM *off*,
-- because it'll already have been run by Device:init before this patch runs...
-- Otherwise we'll flip the Screen's bb invert flag the wrong way around ;).
local is_nm = Screen.night_mode
if is_nm then
Screen:toggleNightMode()
end
Device.canHWInvert = function() return false end
if is_nm then
Screen:toggleNightMode()
end
@formula-spectre
Copy link

how do I apply this patch?

@NiLuJe
Copy link
Author

NiLuJe commented Oct 13, 2023

@formula-spectre
Copy link

done that

@NiLuJe
Copy link
Author

NiLuJe commented Oct 14, 2023

Updated to fix the breakage when restarting with nightmode enabled ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment