Im personally using Vaio VPCCW21FX (Nvidia Graphic) and Ubuntu Studio 11.10 ..
I tried many solutions and nothing could resolve my problem with LCD brightness!
Finally wrote these two perl files to manually set brightness/Contrast and Gamma functions inside Nvidia driver config file.
This will be helpfull only if you are able to change brightness within Nvidia X Server Settings
Step 1: create this file and name it "Brightness-Up.pl"
(you can use any text editing tool like : gedit,nano,vi,etc.. copy & paste)
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) { chomp $_;$value= substr($_,16,5); }
if ($_ =~ /$find2/) { chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value > 0.0) { $value = $value - 0.30 };
if ( $value2 > 1.1) { $value2 = $value2 - 0.08 };
$last_value = $value + 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value + 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 + 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! \n");
foreach ( @Lines )
{ chomp;print "$_\n";print fh2 "$_\n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 2: then make another file, name it "Brightness-Down.pl" and fill with this code:
### Code by forgottenrip@yahoo.com ###
my $find1 = "0/RedBrightness=";my $find2 = "0/RedGamma=";
open FILE, "<Nvidia-Settings.cfg";
my @lines = <FILE>;
for (@lines) {
if ($_ =~ /$find1/) {chomp $_;$value= substr($_,16,5);}
if ($_ =~ /$find2/) {chomp $_;$value2= substr($_,11,5);}
}
my @Lines;
if ( $value < -0.80) { $value = $value + 0.30 };
if ( $value2 < 0.8) { $value2 = $value2 + 0.08 };
$last_value = $value - 0.30;
$Lines[0] ="0/RedBrightness=".$last_value;
$Lines[1] ="0/GreenBrightness=".$last_value;;
$Lines[2] ="0/BlueBrightness=".$last_value;;
$last_value = $value - 0.30;
$Lines[3] ="0/RedContrast=".$last_value;;
$Lines[4] ="0/GreenContrast=".$last_value;;
$Lines[5] ="0/BlueContrast=".$last_value;;
$last_value = $value2 - 0.08;
$Lines[6] ="0/RedGamma=".$last_value;;
$Lines[7] ="0/GreenGamma=".$last_value;;
$Lines[8] ="0/BlueGamma=".$last_value;;
$filename = "Nvidia-Settings.cfg";
open fh2,'>',$filename or die ("can't open '$filename': $! \n");
foreach ( @Lines )
{ chomp;print "$_\n";print fh2 "$_\n"; };
close fh2;
`nvidia-settings -l --config=Nvidia-Settings.cfg`;
Step 3: You need to create another file which contains Nvidia Settings..
name it "Nvidia-Settings.cfg" its important that you write name exactly same.
fill with:
0/RedBrightness=0.1
0/GreenBrightness=0.1
0/BlueBrightness=0.1
0/RedContrast=0.1
0/GreenContrast=0.1
0/BlueContrast=0.1
0/RedGamma=1.14
0/GreenGamma=1.14
0/BlueGamma=1.14
Thats it! now place these files in unique folder.. you have to bind your Function Keys to these two perl file.you can use Compiz>commands to do that.
Run below command to install the compizconfig-settings-manager
sudo apt-get install compizconfig-settings-manager
or even you can run seperately with these two commands in shell (terminal):
user$ perl Brightness/Brightness-Up.pl
user$ perl Brightness/Brightness-Down.pl
where Brightness is folder I put those files in it.
I had the same problem with my Vaio and Ubuntu.
I got it working with the nvidiabl-module and the oBacklight script.
The script is available from this repository, and these instructions may be helpful.
Or use the newer DKMS-based way described in the README file. If you use that technique, you really should read that file thoroughly. However, one method that should work is to download a .deb
file and install it. The project is inactive so nvidiabl-dkms_0.87_all.deb
will likely remain the latest .deb
package. You can download and install that package with these two commands:
wget https://raw.githubusercontent.com/guillaumezin/nvidiabl/master/install/deb/nvidiabl-dkms_0.87_all.deb
sudo dpkg -i nvidiabl-dkms_0.87_all.deb
The README has information on other ways to install, as well as uninstalling.
Best Answer
1) Open a terminal
2) type this: gksudo gedit /etc/X11/xorg.conf
3) Enter your password; a text editor will appear, find the following lines:
4) make this line look like this or add it if it dosen't exist:
Option "RegistryDwords" "EnableBrightnessControl=1"
5) close & save changes (Be careful before saving you can take down your system, if you're not sure that you didn't do anything wrong choose "don't save"!!
6) Restart computer.