LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Reply
 
Search this Thread
Old 05-21-2011, 08:34 PM   #1
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Rep: Reputation: 0
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?
 
Old 05-22-2011, 04:04 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
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...
 
0 members found this post helpful.
Old 05-23-2011, 10:35 AM   #3
roygbiiv
LQ Newbie
 
Registered: May 2011
Distribution: Arch Linux
Posts: 25

Rep: Reputation: 13
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

Last edited by roygbiiv; 05-23-2011 at 10:48 AM.
 
0 members found this post helpful.
Old 05-24-2011, 01:07 PM   #4
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Snark1994 View Post
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.
 
Old 05-24-2011, 01:15 PM   #5
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by roygbiiv View Post
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
 
Old 03-20-2013, 01:10 AM   #6
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Worked for me!

Quote:
Originally Posted by belltown View Post
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 View Post
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!
 
Old 09-17-2014, 04:50 AM   #7
tcuc
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Question Worked great! as root...

this worked great:
Code:
echo "24">/sys/class/backlight/acpi_video0/brightness
but how can i do this as a regular user?
I want to bind this to a hotkey in openbox but i cant exactly do stuff as root there.
 
Old 09-17-2014, 05:28 AM   #8
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by tcuc View Post
but how can i do this as a regular user?
I want to bind this to a hotkey in openbox but i cant exactly do stuff as root there.
You should use "xbacklight" package then. If you have it installed then first of all see
Code:
man xbacklight
. There you can find, e.g.
Code:
xbacklight -inc 20
It increases brightness on 20%. It is the best way.
xbacklight man page on-line.
 
Old 09-17-2014, 07:43 AM   #9
tcuc
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Thumbs up Perfect!

that was perfect! thanks allot!
 
Old 09-17-2014, 09:01 AM   #10
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by tcuc View Post
that was perfect! thanks allot!
You are wellcome! Have a nice linux time and smooth workflow with it (=
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bind certain keys to change screen brightness alquery Linux - General 10 08-24-2010 07:38 PM
ctrl+up|down don't change screen brightness any more zoran119 Slackware 1 07-17-2010 02:44 PM
Brightness of screen does not change. rao_ec@yahoo.com Ubuntu 3 10-07-2009 11:29 PM
how to change screen resolution in terminal (ubuntu) sunnior Linux - Newbie 1 09-25-2008 09:32 AM
How to change screen brightness? (Debian + Fujitsu T4010D) Buttpt Linux - Newbie 4 02-28-2008 12:39 PM


All times are GMT -5. The time now is 04:11 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration