Thread: Glo Kobo Night Mode
View Single Post
Old 11-27-2014, 03:19 AM   #446
traycold
Connoisseur
traycold doesn't littertraycold doesn't litter
 
Posts: 63
Karma: 196
Join Date: Oct 2010
Device: Kobo Glo Hd, Kobo H2O2
Kobo NightMode improvements

hi all,
I introduces some new features on nightMode (based on v13 of nightMode).

Expecially the firts one may be of interests to Kobo H2O owners, since it allows to enable/disable nightmode without the need of a physical button and without adding any other tool (like ksm) on top of standard Kobo Nickel app.
But it may be useful to other model owners too, since it allows to execute any script from Nickel app.
  • Brightness-controlled actions
    you can use brightness level to trigger nightmode enable/disable, or even launch any linux command / script.
    The idea is: you associate an action to execute to a (configurable) brightness level (typically: a value that normally you don't use, let's say 34%). Then, when you set brightness using Kobo UI to that level, and maintain it for a (configurable) number of seconds (for example: 5 s), the associated action is triggered.
    You can configure in theory 101 custom action, one for each brightness level between 0 and 100.
    Configuration is done on nightmode.ini.
  • Brightness 1% patch
    When debugging on above feature, I discovered (but honestly, I think it's something already well-known, I vaguely remember reading something about it somewhere but cannot find it now) that when you set brightness to 1% through Kobo UI, actually Nickel send to kernel/driver the command to set it to 2%. Don't know exactly why, probably because for some reason if brightness is set to 0% (i.e. it is off) at driver level, and you set it to 1% (at driver level, making the relevant ioctl call) the light keeps off; you need to set it to 2% to turn it on. When it's already on, you can lower it to 1%.
    My patch consists in "guessing" the cases when the user probably really wants to set brightness to 1% (typically: when 1% is shown on user interface). In this case it force the set to 1%.
    Warning: the "guess" will only work in some common situations, but cannot guarantee to work in all scenario, see nightmode.ini for some further details.
    You can enable/disable this patch through nightmode.ini

I made some tests on my Kobo and everything seems to be ok (i.e.: no crash or unwanted behaviours), but I'm really a noob as C developer, so I really could have written "bad" things . USE THIS PACKAGE AT YOUR OWN RISK!
If you would like to test it for yourself, you can downlad (and review the source) the patch directly on github repo.
Typically, if you already have NightMode patch v13 already installed, you just need to replace the screenInv.so file, and update the nightMode.ini configuration file adding configurations related to brightness control (the file on repo is commented to explain how to configure these options).

I hope you may find it useful.
Any feedback is welcome.

Last edited by traycold; 11-27-2014 at 03:22 AM.
traycold is offline   Reply With Quote