perkele1989 / light Goto Github PK
View Code? Open in Web Editor NEWGNU/Linux application to control backlights
Home Page: http://haikarainen.github.io/light
License: GNU General Public License v3.0
GNU/Linux application to control backlights
Home Page: http://haikarainen.github.io/light
License: GNU General Public License v3.0
When i tried to use light seemingly nothing happened, however when i used it with sudo it worked just fine, so i turned on the warning and error messages to see what's going on. I got the following messages:
[dreamer@localhost ~]$ light -A 5 -v 3 Automatic mode -- finding best controller. warning: "could not open controller brightness file for writing, so controller is not accessible", in "src/light.c" on line 648. warning: "controller not accessible", in "src/light.c" on line 722. error: "could not find an accessible controller", in "src/light.c" on line 731. error: "could not find suitable controller", in "src/light.c" on line 268. error: "Initialization failed", in "src/main.c" on line 13. [dreamer@localhost ~]$ sudo light -A 5 -v 3 [sudo] dreamer jelszava: Automatic mode -- finding best controller.
I'm pretty much a linux newbie so it's comepletely possible that i didn't configure something what i should have. I just installed the community package provided by FrostyX. Also i'm suspecting permission problems.
However, if I download the current sources (MASTER) and perform the above steps the program works as expected.
Can you make a new release so when I package it I can use your version?
recently intel driver has has gotten worst which resulted in tearing with compiz was fixed with the xf86-video-modesetting compiz-reloaded/compiz#33
light works perfectly but relies on the command line the, which can be manually binded to keyboard but it does'nt gives the integrated experience like showing the notification.
or the Power Manager Plugin for xfce4
Reference:
As title states. unsigned long
is pretty much deprecated since C99. uint64_t
is so much more clean.
I will fix issue when writing the device interfacing API
Not an issue, but since there's nowhere else to contact you on GitHub, I'm writng this here. Your 'Light' package is great! Kudos, dude. Keep it up ๐ :)
i can't set the right controller (acpi_video0 , xcfe4-power-manager sets his value there) and I'm also not able to set the minimum value for the other controller (can't test the other one but at value 0 is the brighness the same as at around 10 on the other controller (radeon_bl0) so i think it was set somewhere else...
`ls -lash /sys/class/backlight/
total 0
0 drwxr-xr-x 2 root root 0 Okt 10 00:34 .
0 drwxr-xr-x 61 root root 0 Okt 10 00:34 ..
0 lrwxrwxrwx 1 root root 0 Okt 10 00:35 acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0
/0000:01:05.0/backlight/acpi_video0
0 lrwxrwxrwx 1 root root 0 Okt 10 00:35 radeon_bl0 -> ../../devices/pci0000:00/0000:00:01.0
/0000:01:05.0/drm/card0/card0-LVDS-1/radeon_bl0`
`light -s acpi_video0 -v 3
/sys/class/backlight/acpi_video0/brightness.
/sys/class/backlight/acpi_video0/brightness.
22.22```
`light -A 5 -v 3
Automatic mode -- finding best controller.
/sys/class/backlight/radeon_bl0/brightness.
/sys/class/backlight/acpi_video0/brightness.
ignoring controller as better one already found.
/sys/class/backlight/radeon_bl0/brightness.
/sys/class/backlight/radeon_bl0/brightness.`
I've installed ATI propietary drivers on Arch Linux and now I can't raise brigtness. At least I can decrease it or set it.
Keep up the good work!
I have an iMac 27After I updated my system this working,
lightstopped working. I have to manually edit my
/sys/class/backlight/acpi_video0/brightness` file to get the brigthness changed.
I'm running light-git
and i'm on 4.15.2-2-ARCH
I'm running a new ThinkPad T480s. Light is failing with the following issue:
โฏ ./light -S 10 -v 2 warning: "could not open '/sys/class/backlight/intel_backlight/brightness' for writing", in "src/helpers.c" on line 189.
warning: "check if this file exists or if you have the right permissions", in "src/helpers.c" on line 189.
warning: "could not open controller brightness file for writing, so controller is not accessible", in "src/light.c" on line 787.
warning: "controller not accessible", in "src/light.c" on line 906.
error: "could not find an accessible controller", in "src/light.c" on line 914.
error: "could not find suitable controller", in "src/light.c" on line 332.
error: "Initialization failed", in "src/main.c" on line 13.
/sys/class/backlight/intel_backlight/brightness
does exist and contain a brightness value, so it looks like the problem is that light can't get permissions.
After the change in src/Makefile.am
(changing -std=gnu99
to -std=gnu18
) light won't build without the very latest version GCC.
Not sure if this is exactly an issue but the latest packaged version for Ubuntu 18.04 is 4.7 and I'm not sure how many people would be willing to build GCC from sources.
As mentioned in #45, changing light to be a non-SUID root application will require caching brightness/min-cap settings where the user has write permission.
My keyboard's driver exposes the backlight brightness via the /sys/bus/hid/drivers/razerkbd/0003:1532:0232.0003/matrix_brightness
file, with values between 0 and 255.
Is it somehow possible to make light
pick this up, so I can use it to manage my keyboard's backlight?
I don't know how, but your LICENSE file has broken formatting. It lacks spacing and indentation.
Here's an exemple where it looks right: https://github.com/stuntrally/stuntrally/blob/master/License.txt
Hello,
would you think supporting external displays is in scope? I'm talking about modern displays that expose some control interface via their USB port. My Dell UP2516D does so and Dell provides a cross platform SDK for just this purpose. 1
Not sure how many backends you would want to support, or if you even want to extend this project at all, just asking before I start to sink time on a possible PR. :)
Regards
root@z420 ~/light-master/src # ./light -L
couldn't find a device target at the path "sysfs/backlight/auto". Use -L to find one.
root@z420 ~/light-master/src # ./light -G
couldn't find a device target at the path "sysfs/backlight/auto". Use -L to find one.
Please consider adding an option to override the udev rules directory.
See here for an example.
I would be really nice if there could be possibility to smoothly inc/dec backlight. Now it looks very sharp :(
Hello, I have a problem adjusting my laptop's brightness. I previously tried out Xbacklight, but it didn't work for me. So I installed Light.
The installation went without problems. The commands are "working", not a single error:
The thing is that my screen's brightness just does not change even though no errors are returned. My laptop is using the radeon_bl0 controller.
There are three backlight-related plain text files in my /sys/class/backlight/radeon_bl0:
The values of actual_brightness
and brightness
actually do change after adjusting the brightness with Light, but my screen just isn't affected by it. I have also rebooted my laptop several times, without luck.
I would appreciate any suggestions!
For my new i3 install I have written a small Python script, that serves me much better for light adjustment, compared to linear +-10 steps. I would like to ask if a patch that implements similar functionality inside this app would be accepted?
import os
import subprocess
import sys
SETTINGS = [0, 0.1, 0.2, 0.3, 0.45, 0.6, 0.9, 1.2, 1.8, 2.7, 4, 6, 9, 13.5, 20, 30, 45, 67, 80, 100]
current_setting = subprocess.check_output(['light', '-G'])
cs = float(current_setting)
distances = [(idx, (cs - st) ** 2) for idx, st in enumerate(SETTINGS)]
close_setting, _ = min(distances, key=lambda x: x[1])
if len(sys.argv) == 1:
raise ValueError("Missing argument, use +/-")
elif sys.argv[1] == '+':
maxs = len(SETTINGS) - 1
new_setting = close_setting + 1 if close_setting != maxs else maxs
elif sys.argv[1] == '-':
new_setting = close_setting - 1 if close_setting != 0 else 0
else:
raise ValueError("Bad argument, use +/-")
subprocess.check_call(['light', '-S', str(SETTINGS[new_setting])])
SUID root binaries after install is usually frowned upon. With light we have the option to instead use the udev rules, and as long as the user is member of the video
group light would operate the same as with SUID root set.
Looks like #9 added a manpage. I'd love to see a new release with this included, especially considering that the last release was two years ago and there hasn't been much traffic since (and likely won't be soon).
Rather than installing light
as SUID executable, distribute it with following udev
rule or manual post-installation step expected to be done by user.
==> /etc/udev/rules.d/90-backlight.rules <==
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
If installed by package it could go to /usr/lib/udev/rules.d/90-backlight.rules
.
On my laptop, the brightness last set using its Fn key is restored after screen blanking โ ignoring any previous value set via light.
light -s intel_backlight -S 100
# Blank screen
xset dpms force off
# Wake up screen
# Brightness is set to the last Fn key brightness
In contrast, when using acpi_video0 the brightness is restored to the value last set via light.
From what I see Light does not support setting brightness on a secondary monitor. I run a laptop with a HDMI monitor plugged into it, like many other users too. It would be great if I could adjust brightness to both via Light. But I assume due to the lack of tools out there to do it it may not be trivial?
PS: Light works for me great under Lubuntu+i3wm where all other tools failed me.
Plugins to install new enumerators. Modules will be installed to /usr/lib/light/enumerators/
, which will be automatically iterated over on program start, loading any modules residing in that directory. Optimally requires light to be split into a library and executable, to let plugins reuse as much code as possible from light.
The Arch User Repository is updating to a new version tomorrow, and while light-git is unadopted, it won't show up in searches. So, I'm assuming you'll also want to adopt this, if not I'm willing to.
First of all, thanks for developing light! It works like a charm!
I wanted to address a few minor points that surprised me during manual installation:
help2man
is nowhere listed as a dependency in the README file.make install
(or rather sudo make install
) should make sure that /usr/share/man/man1/light.1.gz
is world-readable after creating the file. (I set a rather restrictive umask
for my personal user account and it seems help2man
is respecting this umask setting when creating light.1.gz
.)make uninstall
will remove the directory /etc/light
even though this directory is never being created by make install
in the first place. I suppose this line is legacy code from an earlier version?I think it might be a good idea to have something like a "pretend" flag for testing. This could be useful for someone who wants to test a change but isn't currently using a device with a backlight (such as anything else but a laptop).
Maybe redirect the writes to a regular file instead of /sys/...
to have potential testing capability as a cherry on top.
As the title states. This project seems to be growing in popularity still to this date, something that I never expected. The problem is that I no longer have time to maintain it (with 3 kids and a fulltime job).
Requirements:
Feel free to reply here or contact me at fredrik dot haikarainen at google mail
Hello. I'm trying this package out on a Ubuntu system, and neither the github README's instructions (running ./configure
) or homepage instructions (make && make install
) are valid (there is no ./configure
script, and there is no makefile). Is it possible to update the install instructions for those of us less familiar with whatever build system this tarball needs?
Hello,
Since linux 4.11, on ArchLinux, light keeps failing when getting or setting the backlight:
$ light -S 40 -v 3
Automatic mode -- finding best controller.
/sys/class/backlight/intel_backlight/brightness.
/sys/class/backlight/intel_backlight/brightness.
/sys/class/backlight/intel_backlight/brightness.
error: "file contents are corrupt", in "src/helpers.c" on line 74.
error: "could not read minimum cap from file", in "src/light.c" on line 797.
error: "could not get min brightness", in "src/light.c" on line 346.
error: "Execution failed", in "src/main.c" on line 19.
It seems that the min_backlight file has been removed from /sys/class/backlight/intel_backlight
:
$ ls -al /sys/class/backlight/intel_backlight/
total 0
drwxr-xr-x 3 root root 0 24 mai 14:04 .
drwxr-xr-x 6 root root 0 24 mai 14:04 ..
-r--r--r-- 1 root root 4,0K 24 mai 14:20 actual_brightness
-rw-r--r-- 1 root root 4,0K 24 mai 14:20 bl_power
-rw-rw-r-- 1 root video 4,0K 7 juin 13:46 brightness
lrwxrwxrwx 1 root root 0 24 mai 14:20 device -> ../../card0-eDP-1
-r--r--r-- 1 root root 4,0K 24 mai 14:20 max_brightness
drwxr-xr-x 2 root root 0 7 juin 13:40 power
lrwxrwxrwx 1 root root 0 31 mai 10:10 subsystem -> ../../../../../../../class/backlight
-r--r--r-- 1 root root 4,0K 24 mai 14:20 type
-rw-r--r-- 1 root root 4,0K 24 mai 14:20 uevent
I'm using the light-git
package, and have a xps 9560 (Skylake CPU).
Thanks!
The fading feature of xbacklight is very pleasent to the eye.
Will light
have something similar in the future ?
As the title states. Would greatly benefit the repo since issues like #55 are rather common. Would need a process of updating the AUR, preferrably automatically.
For AUR packages:
After upgrading to v1.1, I can no longer save or restore brightness.
$ light -O -v3
Wrong operation specified for brightness. You can use only -G -S -A or -U
Usage: light <options> <value>
<value> has to be either integral(raw mode) or decimal(percent mode) depending on the specified value mode.
<options> can be any of the following:
Operations (can not be used in conjunction):
-H -h: Prints this help and exits
-V: Prints version info and exits
-G: Get value (default)
-S: Set value
-A: Add value
-U: Subtract value
-L: List controllers
-I: Restore brightness
-O: Save brightness
Targets (can not be used in conjunction):
-l: Act on screen backlight (default)
-k: Act on keyboard backlight
Fields (can not be used in conjunction):
-b: Brightness (default)
Used with [GSAU]
-m: Maximum brightness
Used with [G]
-c: Minimum cap
Used with [GS]
G returns null if no minimum cap is set.
Controller selection (can not be used in conjunction):
-a: Selects controller automatically (default).
-s: Specify controller to use. (needs argument)
Value modes (can not be used in conjunction):
-p: Interpret <value> as, and output values in, percent. (default)
-r: Interpret <value> as, and output values in, raw mode.
Other:
-v: Sets the verbosity level, (needs argument).
0: Only outputs read values.
1: Read values, Errors.
2: Read values, Errors, Warnings.
3: Read values, Errors, Warnings, Notices.
error: "could not parse arguments", in "src/light.c" on line 293.
error: "Initialization failed", in "src/main.c" on line 13.
Adding and subtracting values with -A
and -U
works fine. Saving and restoring previously worked in v1.0.
When substracting a number which will produce a negative result, the conversion to unsigned results in the brightness becoming very high, usually maximum.
I'm trying to follow README.md and download tarball from GitHub releases page, but these don't contain neither ./configure nor ./autogen.sh:
$ tar -tf light-1.1.2.tar.gz
light-1.1.2/
light-1.1.2/.gitignore
light-1.1.2/CHANGELOG
light-1.1.2/LICENSE
light-1.1.2/Makefile
light-1.1.2/README.md
light-1.1.2/include/
light-1.1.2/include/helpers.h
light-1.1.2/include/light.h
light-1.1.2/makeexec.sh
light-1.1.2/src/
light-1.1.2/src/helpers.c
light-1.1.2/src/light.c
light-1.1.2/src/main.c
I'm not sure if I'm not missing anything. The README.md in the tarball is older form and has copyright up to 2014, so it looks like the content is actually from other release.
(By the way, the release naming format has changed from v1.0
to 1.1
, perhaps this could have broken some release scrirpt?)
We need to limit the amount of processes that want to write to a single target at the same time, without limiting user operations. When light is executed to write to a target, it must first kill any conflicting processes.
As a prerequisite to smooth transitions. Smooth transitions would execute many sequential writes over a period of time in the same process. If multiple process instances write to the same target at the same time, jittery and undefined behaviour would occur. Therefore, any older light processes that target the same target must be killed before any writes are made.
At program start, when we have decided to write to a target, check for writelocks (using fcntl) on cache/target/pid
. If it is locked, read the pid and kill the process it refers to (assert process filename). Then, create a write lock and write our own pid to the file, then proceed as normal. When program exits, lock is released.
Besides display backlight, it would be great to control keyboard backlight in the same manner. I can deal with this in a few weeks maybe.
Is it possible to decrease backlight like light -U 5
but not below minimum? I bind light
to media keys but it is uncomfortable to decrease backlight and at the and have no light at all. Some parts of documentation is unclear for me.
From the last update I'm no more able tu update light. When I run yay it end with error:
errore: impossibile eseguire l'operazione richiesta (file in conflitto) light-git: /usr/local/share/man exists in filesystem (owned by filesystem)
After my latest mesa upgrade, light consistently fails; here is the output of light -v3 -s10
error: "could not open file for reading", in "src/helpers.c" on line 68.
error: "could not read value from brightness file", in "src/light.c" on line 565.
warning: "could not read controllers brightness file, so controller is not accessible", in "src/light.c" on line 630.
error: "selected controller is not valid, make sure this application is run as root.", in "src/light.c" on line 275.
error: "Initialization failed", in "src/main.c" on line 13.
What needs to be done before a merge:
strdupa
for example)strcmp
with strncmp
bool _light_get_target_path(light_context_t*, char* output_path, size_t output_size);
for better code reusal in commands etc.More?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.