Skip to content

Conversation

hanakomisa
Copy link

@hanakomisa hanakomisa commented Sep 14, 2025

This is a continuation of PR #568, as always, the original light controller code was pulled from PR #520, fixed up to work with the current codebase, as well as adding more things to handle the different properties of the Shine 4 and Vision 6.

Original light controller code credit to dboleslawski. Vision 6 has been personally tested. Thanks to Waldy for testing the Epos 3 and Shine 4 for me. Shine 4 has been confirmed to be fully supported with this commit (Light/E-ink), Epos 3 light controls also work with no issues.

As per those two PRs, same caveats apply.

  1. E-ink controller only works on the B300 Tolinos when the persist.mode.global property is 0. This has been the case for the Vision 6 and Epos 3 already, so there shouldn't be any qualms of me adding NGL4 driver support to the Shine 4.
  2. The light controller requires "Modify System Settings" permission to be turned on. I have added a check for the permission and have it display a toast saying "Please enable 'Modify system settings' for KOReader in Android settings." if WRITE_SETTINGS permission isn't granted when you try to change the brightness/warmth.

Originally, I had tried implementing an intent launch to the correct Settings page if the permission hasn't been granted, however, when I return to KOReader, the app crashes and I feel like fixing that ANR crash would be far outside the scope of this PR, therefore I have decided to settle with just a notification toast warning you about it.

Once this PR goes through, I will open another in the main KOReader repo to update the wiki accordingly, also mentioning the E-ink driver quirk so those with B300 Tolinos can find out why the E-ink controller doesn't refresh their screen.


This change is Reviewable

@Frenzie Frenzie changed the title Adding support for the Tolino Shine 4, and a proper light controller for the B300 Tolino devices. Add support for the Tolino Shine 4, and a proper light controller for the B300 Tolino devices Sep 14, 2025
@hanakomisa
Copy link
Author

@hugleo @pazos I assume we're good to merge?

@hugleo
Copy link
Contributor

hugleo commented Sep 24, 2025

@Frenzie
Copy link
Member

Frenzie commented Sep 24, 2025

I don't see how you would. ;-)

@hugleo
Copy link
Contributor

hugleo commented Sep 24, 2025

My only complaint is whether this is the better way to implement needsInvertedWarmth, import DeviceInfo for lights.

@hanakomisa
Copy link
Author

My only complaint is whether this is the better way to implement needsInvertedWarmth, import DeviceInfo for lights.

How exactly do you mean by this? I'm not sure how else I would go about implementing it seeing this is basically my first time writing kotlin (and basically my second time writing code in general lol)

@hugleo
Copy link
Contributor

hugleo commented Sep 25, 2025

This works, it's just a matter of making the code modular.

Some tolino devices are identified using files on device firmware:

private val COLOR_FILE = if (File(COLOR_FILE_VISION4HD).exists())

I don't know if it's better to import DeviceInfo into lights since the implementation is separated for device match, or if it should use an additional driver for the inverted warmth, or maybe try another trick like the Tolino root driver. That's why I asked @pazos to opinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants