This commit is contained in:
Alessandro Mauri 2024-10-10 23:47:34 +02:00
parent 810a7e29b8
commit 2c1e78f723
2 changed files with 12 additions and 0 deletions

7
TODO Normal file
View file

@ -0,0 +1,7 @@
[ ] Add a config file
[ ] Use a better filter than a simple median, maybe a kalman filter
[ ] Add a way to customise the brightness curve
[ ] Automatically detect backlight device, or at least make it configurable
[ ] Add signal handlers
[ ] SIGUSR1 to reset the user offset
[ ] Handle kill by closing all file descriptors

View file

@ -55,6 +55,9 @@ int read_int(FILE *fp)
return r; return r;
} }
// TODO: add some command line options like:
// -v: verbose/logging
// -c file; specify a config file
int main (void) int main (void)
{ {
// open the luminance device // open the luminance device
@ -131,6 +134,7 @@ int main (void)
} }
brightness_adjusted = MIN(MAX(brightness_target + user_offset, min_brightness), max_brightness); brightness_adjusted = MIN(MAX(brightness_target + user_offset, min_brightness), max_brightness);
// TODO: put this in write_int() function
x = snprintf(STR_BUFFER, sizeof(STR_BUFFER), "%d", brightness_adjusted); x = snprintf(STR_BUFFER, sizeof(STR_BUFFER), "%d", brightness_adjusted);
if (x <= 0) { if (x <= 0) {
fprintf(stderr, "Error in snprintf(): %s\n", strerror(errno)); fprintf(stderr, "Error in snprintf(): %s\n", strerror(errno));
@ -156,6 +160,7 @@ int main (void)
user_offset = off; user_offset = off;
} }
// TODO: option to turn off logging
printf("brightness target: %d; user offset: %d; brightness adjusted: %d\n", brightness_target, user_offset, brightness_adjusted); printf("brightness target: %d; user offset: %d; brightness adjusted: %d\n", brightness_target, user_offset, brightness_adjusted);
} }