backlight-adaptive Original

Utilities adaptive ambient backlight

Source (link to git-repo or to original if based on someone elses unmodified work): https://www.opencode.net/nick87720z/backlight-adaptive

0
5.0
Description:

Adaptive backlight daemon, using camera as light sensor.

License: GPL v3

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)

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

awk: command line: 54: fatal error: trying to divide by zero ?

Report

C

nick87720z

1 month ago

Fixed. It will force non-zero minimum when fade enabled. If you really need monitor off, in this way, you could set --bl-min to something like 0.0001, but for me it took half-second after reaching minimum level before monitor turned off (there is already DPMS for power management).

Report

kris007

1 month ago

now no errors ... but it probably doesn't work or I have wrong settings?
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

C

nick87720z

1 month ago

Please check permissions setup in readme (it was to be added in begining). If this doesn't fix, please "sh -evx ./backlight-adaptive" output (this will show, what it does wrong).

Report

C

nick87720z

1 month ago

Did problem resolve?
If not, can you please post output from "sh -evx ./backlight-adaptive"?

Report

kris007

1 month ago

Now I have:
Pipeline terminated on its own
+ exit

Report

C

nick87720z

1 month ago

What version did you use?

Report

kris007

1 month ago

https://www.opencode.net/nick87720z/backlight-adaptive
from this page after downloading a tar package ....I did wrong ... uppss :-(

Report

C

nick87720z

1 month ago

Will continue here, before maximum post width shrinks to 1-2 characters :D.
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

C

nick87720z

1 month ago

Ok. Please check latest git version. I added permission check for internal backend, so it will tell if permissions are denied.

Report

kris007

1 month ago

I ran like this:
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

C

nick87720z

1 month ago

Confirming, it will not work under root (sudo). Without root it's fine.

Report

kris007

1 month ago

without sudo
Can't write to '/sys/class/backlight/acpi_video0/brightness'

Report

kris007

1 month ago

after adding user to video group ... it's OK
but I'm getting this error again:
Pipeline terminated on its own
:-)

Report

C

nick87720z

1 month ago

Ah, so, now you can write to that file, right? Please, run script file as "sh -evx file" and show me output.

Report

C

nick87720z

1 month ago

What's group for that file? Must be video, not root. Create (copy) file with udev rules to where all rules reside, then reboot.

Report

kris007

1 month ago

I think I have something wrong with the system keeps getting:
Can't write to '/ sys / class / backlight / acpi_video0 / brightness'

Report

kris007

1 month ago

and unfortunately the brightness control does not work at all in my system

Report

kris007

1 month ago

https://pastebin.com/ZKNjYBBn

Report

kris007

1 month ago

https://easyupload.io/lmbu60

Report

C

nick87720z

1 month ago

That looks like default settings. Some sign, that it passes config load/save (it creates new when finds writeable dir and there is still no loaded config to this point). I need to know following:
- 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

C

nick87720z

1 month ago

It requires minimum backlight non-zero, because of fading done in logarithmical scale (i.e. fade speed is always relative of current backlight level rather than absolute). Could be avoided with smoothness off (0 frames). Working on it.

Report

12345678910
Be the first to comment
File (click to download) Version Description PackagetypeArchitectureRelease Channel Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
GPLv3
version
updated Dec 14 2020
added Nov 24 2020
downloads 24h
0
mediaviews 24h 0
pageviews 24h 1