Giter Club home page Giter Club logo

light's People

Contributors

06kellyjac avatar aesophor avatar alexmohr avatar badochov avatar chrboe avatar eatse21 avatar ebfe avatar eyenseo avatar fredriksvantesson avatar fs-c avatar gerw avatar hph86 avatar ixjlyons avatar lindhe avatar maximbaz avatar mca-gif avatar perkele1989 avatar samueloph avatar sbmueller avatar shizcow avatar sifeiden avatar sim590 avatar stanim avatar thejakeschmidt avatar troglobit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

light's Issues

Commands require sudo to use

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.

Release 1.0 not functional on Ubuntu 16.04 but HEAD is

  1. Download 1.0 release, compile
  2. run light
    Expected result: see some value for current backlight
    Actual result: no output of command (other aspects of command don't seem to work either)

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?

how can i integrate with xfce4

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.

screenshot76

or the Power Manager Plugin for xfce4

screenshot77

Reference:

Use stdint.h for integer types instead

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

Great package!

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 ๐Ÿ‘ :)

setting controller and setting minimum value

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.`

Light stopped working on imac

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

Checklist for v1.2 release

  • Update man page, issue #66
  • Update Debian/Ubuntu packaging, i.e. add entry to debian/changelog, issue #68

Add more items in comments and we'll update the checklist.

Permissions error on ThinkPad t480s

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.

Light won't build with GCC <= 4.7

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.

Test support for the openrazer driver

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?

Support external displays (e.g. Dell UP2516D)?

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

no any device support on HP-Z420 with Ubuntu-14.04.5 64bit OS?

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.

Setting/adding/subtracting brightness does not work

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:

terminal

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:

  • actual_brightness
  • brightness
  • max_brightness, value is 255

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!

Exponential scale

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])])

new release with manpage

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).

Don't install as SUID executable

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.

Different brightness after screen blanking

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.

Brightness control for secondary screen

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.

Pluginsystem, split light into library/executable

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.

AUR4

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.

https://aur4.archlinux.org/packages/light-git

Installation: List dependencies in README, make sure correct permissions are set for man file, don't delete /etc/light

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:

  1. help2man is nowhere listed as a dependency in the README file.
  2. 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.)
  3. A quick look at the Makefile told me that 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?

"Dry run" or "pretend" mode

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.

This project is looking for a maintainer

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:

  • Ability to get the job done

Feel free to reply here or contact me at fredrik dot haikarainen at google mail

Updated installation guide

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?

Could not get min brightness on linux 4.11

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!

Unable to save or restore brightness

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.

Brightness loops when substracting

When substracting a number which will produce a negative result, the conversion to unsigned results in the brightness becoming very high, usually maximum.

Old? content in github releases .tar.gz

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?)

Only allow one process per target for writes

What do we need?

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.

Why do we need it?

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.

How do we achieve it?

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.

Support for keyboard backlight

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.

decrease backlight with respect to minimum value

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.

Cannot upgrade light

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)

[nevermind]

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.

Things to do before merging device-rewrite

What needs to be done before a merge:

  • General code cleanup, whitespace, consistent codestyle, const correctness, etc
  • Remove any GNU-specifics where possible (strdupa for example) (kinda fixed, but we use gnu extensions so were screwed anyway)
  • Update README.md to reflect new usage
  • Create DOCUMENTATION.md to document codebase (how to implement new/custom enumerators etc.)
  • Replace any strcmp with strncmp
  • Create function bool _light_get_target_path(light_context_t*, char* output_path, size_t output_size); for better code reusal in commands etc.
  • closedir!

More?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.