LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   How do I change screen brightness from a terminal? (http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/how-do-i-change-screen-brightness-from-a-terminal-882023/)

belltown 05-21-2011 07:34 PM

How do I change screen brightness from a terminal?
 
I'm running Ubuntu 11.04 with the Gnome Classic (No effects) display manager. My laptop's brightness keys work. However, when I boot or resume from suspend when using the integrated Intel graphics card the display brightness is turned all the way down, and I have to turn up the brightness using the brightness function keys so I that can see the display. I'd like to automate this by putting a terminal command in a script so I can automatically turn up the screen brightness when the system boots.

I've tried the following commands with no success:

Code:

echo 9>/sys/class/backlight/acpi_video0/brightness
What ever I echo in the brightness file has no effect on the screen brightness, and nothing changes in the /sys/class/backlight/acpi_video0/brightness or actual_brightness files. The contents of these files do change, however, if I change the brightness using the keyboard function keys.

Code:

setpci -s 00:02.0 F4.B=10
Some posts have suggested this command might work, but in my case it has no effect. The contents of the F4 register remain at 00, even if I change the screen brightness with the function keys.

Code:

xbacklight -set 90
Using this command I can change the value of xbacklight (i.e. xbacklight -get shows the new value), but the screen brightness does not change. However, if I change the screen brightness using the keyboard function keys then the value of xbacklight -get shows the new value.

Code:

acpi_backlight=vendor
I've tried putting this command on the linux command line when I boot. Even with this parameter I'm still unable to change the screen brightness from the terminal. This parameter also disables the keyboard brightness function keys.

Any suggestions of anything else I could try to change the screen brightness from a terminal?

Snark1994 05-22-2011 03:04 PM

I would look under the Gnome keyboard shortcut configuration, if I remember rightly from when I used Ubuntu you can see what command it runs when you press the brightness keys :) and then you should be able to run that from terminal...

roygbiiv 05-23-2011 09:35 AM

Quote:

Code:

echo 9>/sys/class/backlight/acpi_video0/brightness
What ever I echo in the brightness file has no effect on the screen brightness, and nothing changes in the /sys/class/backlight/acpi_video0/brightness or actual_brightness files. The contents of these files do change, however, if I change the brightness using the keyboard function keys.
does this work?
Code:

sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:

Code:

#!/bin/bash
# set screen brightness level

if [ "$#" = "0" ]; then
        level= cat /sys/class/backlight/acpi_video0/brightness
        echo -n $level
else
        echo  $1 > /sys/class/backlight/acpi_video0/brightness
fi


belltown 05-24-2011 12:07 PM

Quote:

Originally Posted by Snark1994 (Post 4363910)
I would look under the Gnome keyboard shortcut configuration, if I remember rightly from when I used Ubuntu you can see what command it runs when you press the brightness keys :) and then you should be able to run that from terminal...

No, there are no keyboard shortcut keys for the brightness controls. I've found some configurable settings under gconf-editor in the Gnome Power Manager, but nothing tells me what Gnome is using to set the brightness.

belltown 05-24-2011 12:15 PM

Quote:

Originally Posted by roygbiiv (Post 4364604)
does this work?
Code:

sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:

Code:

#!/bin/bash
# set screen brightness level

if [ "$#" = "0" ]; then
        level= cat /sys/class/backlight/acpi_video0/brightness
        echo -n $level
else
        echo  $1 > /sys/class/backlight/acpi_video0/brightness
fi


That doesn't work. I can access the acpi brightness file, but any value I try to echo into that file has no effect, e.g:

Code:

root@john-laptop:/home/john# sudo su
root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
root@john-laptop:/home/john# echo 5> /sys/class/backlight/acpi_video0/brightness

root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10


Evgenii Frolov 03-20-2013 12:10 AM

Worked for me!
 
Quote:

Originally Posted by belltown (Post 4365788)
That doesn't work. I can access the acpi brightness file, but any value I try to echo into that file has no effect, e.g:

Code:

root@john-laptop:/home/john# sudo su
root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
root@john-laptop:/home/john# echo 5> /sys/class/backlight/acpi_video0/brightness

root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10


This worked for me!!! Add quotes around a number!!!
Code:

sudo echo "9">/sys/class/backlight/acpi_video0/brightness
Quote:

Originally Posted by roygbiiv (Post 4364604)
does this work?
Code:

sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:

For me it is 0-20 range!


All times are GMT -5. The time now is 04:17 AM.