Fix backlight on Sony Vaio VPCS13S9E NVIDIA GeForce 310M (Ubuntu)

For future reference:

Fix backlight on Sony Vaio VPCS13S9E NVIDIA GeForce 310M (Ubuntu)

sanky@kuriputo:~$ lspci -nn | grep VGA
01:00.0 VGA compatible controller [0300]: nVidia Corporation GT218 [GeForce 310M] [10de:0a75] (rev a2)

If yours isn't the same, it probably won't work. But if you have problems, you might try doing this.

I use the official drivers, because others don't install or give me a black screen. (If you got this far with the same laptop as me, congratulations.)

Now, for the backlight:

Get nvidiabl-0.55

sudo rmmod nvidiabl
sudo dkms remove -m nvidiabl -v 0.55 --all

Add your laptop to /usr/src/nvidiabl-0.55/nvidiabl-laptops.h - following the instructions there.
Edit /usr/src/nvidiabl-0.55/nvidiabl-module.c
Change line 237:

 nvidiabl_device->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;

to:

 nvidiabl_device->props.max_brightness = 3323208;

Or just any other value that seems correct D: This was the brightenss reported when i had max (probably).

sudo dkms add build install -m nvidiabl -v 0.55
sudo modprobe nvidiabl

Congratulations. Try:

 echo 5 | sudo tee -a /sys/class/backlight/nvidia_backlight/brightness 

That seems to be the max for me. (Yes, it makes no sense, but in the end, i'm happy there is a way to change it, however convoluted.)
No more eye hurting when staring at the screen midnight!


Addendum: If you get a black screen, close and open the laptop.
It probably is possible to set it to the Fn keys, but i'm too lazy to do that.



-- Sanky, 2010-12-11