17

I have two folders in my /sys/class/backlight:

1> acpi_video0 2> intel_backlight

The intel_backlight is useless because I can use the following command to adjust brightness in acpi_video0 (I'm running Nvidia drivers):

e.g: echo 50 > /sys/class/backlight/acpi_video0/brightness

Problem: Using xbacklight -inc +5 outputs: "No outputs have backlight property" so I need to get it to use acpi_video0

So far, I have tried to rm the intel_backlight folder completely with no luck (using both sudo and changing permission to 777 recursively).

I just wanna be able to hotkey the xbacklight to increment and decrement brightness. I can set brightness in acpi_video0 to a hard value using echo but don't know how to adjust it in increments.

Kindly advise further!

Regards :)

EDIT 1: (POSSIBLE ALTERNATIVE) For anyone with this problem in the future, install xcalib. (Setup: Arch Linux w/ i3 window manager)

yaourt -S xcalib

And the following hotkey assignment (i3 in my case) in the config file:

# Brightness control reset screen (100% brightness)
bindsym Mod1+Up exec xcalib -c
# Brightness control down
bindsym Mod1+Down exec xcalib -co 95 -a
catharchy
  • 191
  • 1
  • 1
  • 6
  • Have You specified ACPI_backlight=vendor in Your kernel-boot-parameters ? If not, try it. https://wiki.archlinux.org/index.php/backlight – icbytes May 26 '14 at 09:37
  • I read about that, I have ubuntu and arch on dual boot (i.e. auto-detected the arch install from updating grub within ubuntu post-installation). Would modifying my grub-config to add that (I believe that's what it wants us to do) affect the ubuntu boot process? – catharchy May 26 '14 at 10:30
  • Each OS has an own boot entry. Look, at grub.conf. There You should see, that if You pass kernel parameters to one entry, the other is unchanged. ( would be really bad, if this was not like it is ). – icbytes May 26 '14 at 10:34
  • Makes sense :) I'll definitely try that out and post back. Thanks for the help. – catharchy May 26 '14 at 10:47
  • 1
    Worked perfectly, thank you sir! I don't have 15 rep points yet as I am a new member but if and when I do, I shall vote you up (if that is infact how it works) – catharchy May 26 '14 at 11:45
  • Please add answer and mark it as accepted. – grimsock Oct 07 '15 at 23:21

7 Answers7

23

EDIT: I found this question because I had the same output error: no outputs have backlight property. light solved this with no further tinkering.

A better alternative to xcalib (which doesn't adjust backlight; won't save battery power): light available in community/light.

Usage

  • light -U 20 decrease backlight 20%
  • light -A 20 increase 20%
  • light -S 50 set backlight to 50%

Found here wiki.archlinux.org/index.php/backlight (thanks @icbytes).

AdityaG15
  • 115
  • 3
  • 9
jrdccx
  • 231
  • 2
  • 3
9

I've replaced my xbacklight with the following script :

#!/bin/bash
set -e
file="/sys/class/backlight/intel_backlight/brightness"
current=$(cat "$file")
new="$current"
if [ "$1" = "-inc" ]
then
    new=$(( current + $2 ))
fi
if [ "$1" = "-dec" ]
then
    new=$(( current - $2 ))
fi
echo "$new" | tee "$file"

you have to replace file by the file that you can find by using :

sudo find /sys/ -type f -iname 'brightness'

and you have to make sure that this file is writable : eg :

sudo chmod a+rw /sys/class/backlight/intel_backlight/brightness

edi9999
  • 16,352
  • 11
  • 70
  • 121
  • Note: `sudo find /sys/ -type f -iname "brightness"` did not find the file for me. However, /sys/class/backlight/intel_backlight/brightness is correct in my case. I like this solution as it works in OpenSUSE Tumbleweed also -- I don't see light or light-git in the tumbleweed or pacman repos – Lotus Nov 14 '16 at 02:04
2

To solve similar issue on a fresh Arch install I decided to go with acpilight also available in AUR. Advertised as 'backward-compatibile replacement for xbacklight' it does not depend on X11 as such, works just as fine on Wayland and/or virtual console should such need arise.

After installation the regular user needs to be added to the 'video' group and a drop-in file for a very conservative udev rule neeeds to be created:.

**/etc/udev/rules.d/90-backlight.rules**

SUBSYSTEM=="backlight", ACTION=="add", \
  RUN+="/bin/chgrp video %S%p/brightness", \
  RUN+="/bin/chmod g+w %S%p/brightness"

On some laptops keyboard backlight control is also supported. For more information refer project's github gitlab page linked above.

Hope this helps I found acpilight very handy to setup and use.

NOTE: Python(3) dependent solution.

NOTE 2: At the heart of acpilight lays not much more than a simple python script that can easily be extracted.

muthuh
  • 111
  • 2
  • 10
  • This is a very elegant solution. The need of adding user(s) to the `video` group is essential. – Yuri Sep 08 '18 at 20:00
2

To add to @edi9999 's great solution, this one works with percentages and it can set the limits

#!/bin/bash
MAX=661
MIN=10
set -e
file="/sys/class/backlight/intel_backlight/brightness"
current=$(cat "$file")
new="$current"
if [ "$2" != "" ]; then
    val=$(echo "$2*$MAX/100" | bc)
fi
if [ "$1" = "-inc" ]; then
    new=$(( current + $val ))
elif [ "$1" = "-dec" ]; then
    new=$(( current - $val ))
fi
if [ $new -gt $MAX ]; then
    new=$MAX
elif [ $new -lt $MIN ]; then
    new=$MIN
fi
printf "%.0f%%\n" $(echo "$new/$MAX*100" | bc -l)
echo $new > "$file"
Naheel
  • 457
  • 3
  • 11
1

I've also faced the No outputs have backlight property issue when using xbacklight but stumbled on a simple fix, at least with Fedora 28 on a MacBook Pro 13,1.

While other solutions appear like they should work, I didn't need to install anything nor use any scripts. Hopefully this is applicable for other distros too given that I used the Arch Wiki to help me along:

https://wiki.archlinux.org/index.php/Backlight#ACPI talks about ls /sys/class/backlight/ and in my case, that shows acpi_video0@ and intel_backlight@.

With that, I tried intel_backlight, so I used cat /sys/class/backlight/intel_backlight/brightness to see what the current value was (39).

Using echo 50|sudo tee /sys/class/backlight/intel_backlight/brightness (type info tee for more details about tee) resulted in the backlight brightening - progress!

Now interestingly after doing this, the xbacklight -inc 10 and xbacklight -dec 10 commands started magically working without me doing anything else so I can now bind my keyboard's brightness keys to xbacklight - no further sudo commands or rules required.

1

I'm using openSUSE but it helped to get xbacklight working (again) when I installed the xf86-video-intel package. This included the xorg-x11 drivers for intel graphics card and other stuff like command line utilities. After installing it was possible to control the backlight with xbacklight.

Before that, my only option was to control the backlight only with root permissions via /sys/class/backlight/intel_backlight/brightness

phils3r
  • 11
  • 2
0

I finally fixed this and none of the online solutions that the original poster listed worked for me either. What did solve the problem was going to /etc/default/grub and in the line: GRUB_CMDLINE_LINUX_DEFAULT

Adding :

"acpi_osi="

But also do Not use "nomodeset" on it. Ppl added nomodeset originally to fix the software rendering issue, but this actually causes Linux to not recognize the Nvidia drivers.

Lastly make sure you go to the Linux Start Menu Driver Manager and update your Nvidia drivers to 430 or newer.

Stigma
  • 121
  • 1
  • 9
  • To make these `GRUB_...` settings stick, on Fedora 33, I have to run `sudo grub2-mkconfig -o /boot/grub2/grub.cfg`, then restart. – Reed Mar 30 '21 at 21:28
  • And different entries in `GRUB_CMDLINE_LINUX_DEFAULT` are separated by spaces. So put a space before `acpi_osi=` if there are other values in the GR_CM_LI_DEF... – Reed Mar 30 '21 at 21:31
  • `acpi_osi=` broke my bootloader. You can press `e` in the grub menu to edit the config, then delete `acpi_osi=` & that fixed it for me. – Reed Mar 30 '21 at 23:29
  • DEFINITELY use `GRUB_CMDLINE_LINUX_DEFAULT`, not the `GRUB_CMDLINE_LINUX` which is likely already in your `/etc/default/grub`. the `_DEFAULT` only runs during normal boot, so you can still boot into recovery, fix `/etc/default/grub`, then run `grub2-mkconfig -o /boot/grub2/grub.cfg` again & have a corrected bootloader. – Reed Mar 30 '21 at 23:32