Adaptive backlight daemon, using camera as light sensor.
Features
- smooth backlight adaptation
- start with delay
- one-time mode
- auto-restart on configuration file change
- set maximum light to current by SIGUSR2 signal
- effective: up to 30fps for camera input without notable performance losses
- no need for systemd or X, though xbacklight may be used
Dependencies
Minimum
Optional (alternative)
- ncurses - for colored output
- util-linux - use hexdump instead of od
- inotify-tools - to auto-restart on configuration change
Backlight control backends
Note: It will tell when necessary tools are missing.
Usage
Type backlight-adaptive -h
to see all options.
Useful options
Run with default settings
$ backlight-adaptive
Toggle running
$ backlight-adaptive -t
Match backlight once to current light level and quit.
$ backlight-adaptive -1
Update maximum light level to current
$ backlight-adaptive --calibrate
Update configuration with command line options included
$ backlight-adaptive --update-conf
Backlight change smoothing
Backlight can change smoothly by using multiple box filter stages. Box filters are effective at any buffer length, and 3 of them are enough to get result, comparable by quality with gaussian or cubic spline. Buffer sizes are specified independently for each filter in form of comma-separated number list (no spaces).
Examples for framerate 30fps
Use short anti-fluctuation filter
$ backlight-adaptive --smooth 6,6
Slow accomodation filter
$ backlight-adaptive --smooth 120,120,20
Note: Two equally sized filters seem to be most optimal setup.
Lone one makes linear transition for lone jump between two stable levels, but for short fluctuation it will be just small but constant change for all duration. 2nd filter turns it to linear fade on and off. This should be enough for usable result - for stable change it makes smooth result. 3rd filter smoothes even shortest fluctuations, but each extra stage adds latency between light change and visible backlight reaction.
Configuration
Configuration file is automatically created if no other file exists and writeable config directory is found. Further update may be forced with --update-conf or -u command line option.
Locations
- $XDG_CONFIG_DIR
- ~/.config
- /etc
Supported signals
- SIGUSR1 - reload configuration
- SIGUSR2 - update maximum light level to current
Permissions
Following steps are necessary for internal ACPI backend to work.
- Place 90-backlight.rules into /etc/udev/rules.d or /lib/udev/rules.d to enable write permissions for internal ACPI backend (requires reboot).
- Make sure, that you are in video group (requires relogin).
Note: other tools like acpilight or light may have it already done.
Under hood
Shell script only makes configuration, all dirty job is done by persistant ffmpeg-based pipeline.
Known alternatives
See more backlight utilities
kris007
1 month ago
Report
nick87720z
1 month ago
Report
kris007
1 month ago
my config
acpi_dev =
backend_args =
backends = internal, light, xbacklight
delay = 0.1
fade_frames = 0
grab = true
log_color = false
log_level = info
maxbright = 100
max_color = 35
minbright = 1
watch_conf = true
Report
nick87720z
1 month ago
Report
nick87720z
1 month ago
If not, can you please post output from "sh -evx ./backlight-adaptive"?
Report
kris007
1 month ago
Pipeline terminated on its own
+ exit
Report
nick87720z
1 month ago
Report
kris007
1 month ago
from this page after downloading a tar package ....I did wrong ... uppss :-(
Report
nick87720z
1 month ago
I don't understand, did you add udev rule and ensure, that /sys/class/backlight/acpi_video0/brightness has video group instead of default root? I repeated this through multiple posts.
Report
nick87720z
1 month ago
Report
kris007
1 month ago
sudo ./backlight-adaptive
started without errors ... but nothing is happening probably bad configuration. But after shutting down and restarting, I got the error:
Pipeline terminated on its own
Report
nick87720z
1 month ago
Report
kris007
1 month ago
Can't write to '/sys/class/backlight/acpi_video0/brightness'
Report
kris007
1 month ago
but I'm getting this error again:
Pipeline terminated on its own
:-)
Report
nick87720z
1 month ago
Report
nick87720z
1 month ago
Report
kris007
1 month ago
Can't write to '/ sys / class / backlight / acpi_video0 / brightness'
Report
kris007
1 month ago
Report
kris007
1 month ago
Report
kris007
1 month ago
Report
nick87720z
1 month ago
- Program version. Ideally you are better try latest (git) version prior report. Also need to know versions/implementations for dependencies, at least basic.
- Special note about awk. For now it needs to be gawk (if you used other implementation like mawk or nawk).
- Program output. Try with debug log level. If cli option has no effect, git version has the fix.
- Try to disable all features that can be disabled - config watch, log color.
- Try different backends (default has them on in list, with later used as fallbacks). E.g.: --backends xbacklight. For xbacklight - ensure it works at all, try this: xbacklight -get. If nothing, you probably need acpilight.
- If still no points to error/problem, try this:
$ sh -evx ./backlight-adaptive 2>&1 | tee log
This will give dozens of output, writing it both to your terminal and to log file (find better filename you like). This should be published via pastebin services.
Report
nick87720z
1 month ago
Report