maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   lightsense.pl: Auto-adjust backlight based on ambient light (https://talk.maemo.org/showthread.php?t=70754)

nightfire 2011-03-06 23:44

lightsense.pl: Auto-adjust backlight based on ambient light
 
1 Attachment(s)
Hey guys,

I'm working on a light sensing daemon to automatically adjust the backlight based on detected ambient light.

My work-in-progress (proof of concept, really) is attached, if anyone would like to try it. Specifically, I'd appreciate any feedback about the thresholds I've set or any weird behavior.

Once I've got the algorithm tweaked I'll write a proper daemon in C with a nice settings panel, and clean up the other system events that set the backlight on their own.

For now, just run it as root in a console, throw it in the background, and it'll do its thing. Feel free to play around with the variables defined in the top of the script and send me your settings if you like them better.

hawaii 2011-03-06 23:53

Re: lightsense.pl: Auto-adjust backlight based on ambient light
 
Recommended to kill the daemon when device is locked and respawn it once it's unlocked. dbuscron can be used for that.

I see the displayOn sanity check - but will constantly polling completely destroy battery life?

nightfire 2011-03-07 00:02

Re: lightsense.pl: Auto-adjust backlight based on ambient light
 
Quote:

Originally Posted by hawaii (Post 962101)
Recommended to kill the daemon when device is locked and respawn it once it's unlocked. dbuscron can be used for that.

I see the displayOn sanity check - but will constantly polling completely destroy battery life?

At the moment, yes. :) I literally threw this script together in an hour just to get some feedback on the algorithm.

When I write a proper daemon I'll find a system call I can use to block until the device wakes. There's gotta be one.

I just checked, though, and it's used 8 seconds of CPU time in ~1h, so I doubt this script would make much a difference in battery life.

nightfire 2011-03-08 02:45

Re: lightsense.pl: Auto-adjust backlight based on ambient light
 
Hey everyone,

I rewrote lightsense.pl as a proper daemon in C, and built a package for it. Details here:

EBD - Enhanced Backlight Daemon


All times are GMT. The time now is 04:38.

vBulletin® Version 3.8.8