-
Notifications
You must be signed in to change notification settings - Fork 111
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
[Bug] After waking from sleep, 'Invert Colors' setting is ignored #343
Comments
It's likely a hardware/kernel bug on those old devices. |
Does plato just toggle a system setting that inverts the colours then? I enabled the 'Invert Screen' setting in the developer settings of the device, then tested with and without Plato's 'Invert Colors' settings enabled, and it still returns to 'day mode' after waking from sleep. The Kobo UI retains the dark mode after waking. Does Plato have a hook that can ensure the 'Invert Colors' setting is re-applied upon wake? Would be happy to have a go at it myself if someone can point me in the right direction. |
IIRC (it varied, and the name changed at one point), Nickel's invert thingy does everything in software. It is as such blissfully ignorant of hardware/driver quirks. What's toggled by Plato (and KOReader, for that matter, except on a few specific devices where it's extra broken or plain not available) is instead a driver flag that lets the display driver deal with it. We have no way of knowing when and if it breaks, we're basically just passing an extra flag to refresh requests saying "please invert the buffer on flip". What happens after that is out of our hands. ;). IIRC, Plato doesn't have a software fallback, and just disables the feature on the aforementioned "broken/unavailable" devices. |
Interesting. I added some logging to the As I see it there's 3 options...
I've been trying to tackle option 1, but I'm not particularly familiar with the codebase or Rust in general so I'm not sure I'm headed down the right track with this. diff --git a/crates/plato/src/app.rs b/crates/plato/src/app.rs
index bf3138a..5628302 100644
--- a/crates/plato/src/app.rs
+++ b/crates/plato/src/app.rs
@@ -590,6 +590,18 @@ pub fn run() -> Result<(), Error> {
context.frontlight.set_intensity(0.0);
context.frontlight.set_warmth(0.0);
}
+
+ // workaround for dodgy displaydriver on older devices
+ if CURRENT_DEVICE.mark() < 11 {
+ if context.settings.inverted {
+ context.fb.toggle_inverted();
+ let result = context.fb.update(&context.fb.rect(), UpdateMode::Full);
+ if let Ok(token) = result {
+ context.fb.wait(token).ok();
+ }
+ }
+ }
+
if context.settings.wifi {
Command::new("scripts/wifi-disable.sh")
.status() |
You're assuming the driver reliably breaks on wakeup, which is an assumption I wouldn't be entirely willing to make ;). (And as another nitpick, that Mk. sweep is waaaay too wide). Also, my experience with flag bugs on newer devices is that the driver doesn't rally give a crap if you try to tone done the broken flags for a while, if it wants to be broke, it's going to be broke ;p. The simplest workaround is probably to forgo the PxP inversion and just invert the buffers in software during blit. |
I understood some of these words 😂 Not sure what 'blit' is, or what you mean by Mk. sweep, I assume it has something to do with passing On my device at least, the behaviour is consistent (I recognise that it might vary for other devices, even of the same model). I've been combing through trying to find how I might go about inverting the data that's sent to the framebuffer device - I assume it's kept in memory somewhere, but damned if I can figure out where. The |
I'm not familiar with Plato's graphics backend, but I imagine there's a screen buffer somewhere (or a direct mmap to the hardware backed framebuffer). You (probably) won't find it near the refresh ioctls though, because blitting and refreshing are two very separate things on eInk ;). As for the Mk. sweep, I meant the generation check, i.e., |
NB: only applies if the ereader goes to sleep based on timeout, not if i put it to sleep using the switch or the magnetic case.
Workaround:
Toggle 'Invert Colors' off and back on
Device:
Kobo Glo (N613)
Version:
Plato 0.9.40
The text was updated successfully, but these errors were encountered: