Ubuntu – How to get brightness controls working on a Sony VAIO Fit 15E

14.04brightness

I have a problem with my brightness setting. When I decrease brightness to 1 and I reboot the computer, it reset to maximum brightness value. I tired to adjust it and decrease it again to 1. Why the setting doesn't save the last brightness setting for me? How can I save the current value and restore it after reboot via programming?

I also tried to add echo 0 > /sys/class/backlight/intel_backlight/brightness in /etc/rc.local file, but after rebooting, it reset to the maximum again.

My laptop model is Vaio SVF1521DCXW.

Best Answer

I had another folder named acpi_video0 in this location /sys/class/backlight/

I added following command at the end but before exit 0 in gksu gedit /etc/rc.local file:

 echo 0 > /sys/class/backlight/intel_backlight/brightness
 echo 0 > /sys/class/backlight/acpi_video0/brightness

It worked for me. And now I want to get current brightness and save it into a file to restore it at next restart.

How to functionality last adjusted brightness load after next reboot?

Step 1: Check brightness levels

Set your brightness to maximum and check current level by below command:

 cat /sys/class/backlight/acpi_video0/max_brightness

   (my laptop max brightness is 100 :)

Now set your brightness to minimum and check current level by evoking next command:

 cat /sys/class/backlight/acpi_video0/brightness

   (my laptop min brightness level is 0 :)

Step 2: Create a file to store your current brightness:

 sudo touch /etc/init.d/prev_brightness
 sudo chmod o+w /etc/init.d/prev_brightness

Step 3: Create a script that stores your current brightness(the save_screen_brightness file) when shutting down into the file prev_brightness that you created in the previous step:

 sudo touch /etc/init.d/save_current_brightness
 sudo chmod +x /etc/init.d/save_screen_brightness

Open the save_screen_brightness file with your favorite editor app:

 gksu gedit /etc/init.d/save_screen_brightness

And put this script into it:

 #!/bin/sh
 cat /sys/class/backlight/acpi_video0/brightness > /etc/init.d/prev_brightness

Save it and go to next step ;)

Step 4: Make the script run every time we shutdown or reboot the computer:

 sudo ln -s /etc/init.d/save_current_brightness /etc/rc0.d/K99save_screen_brightness
## Shuttingdown ^^
 sudo ln -s /etc/init.d/save_current_brightness /etc/rc6.d/K99save_screen_brightness
## Rebooting ^^

Step 5: Load the value we stored when starting the computer:

Add the following line at the end and before exit 0 into your /etc/rc.local file:

 cat /etc/init.d/prev_brightness > /sys/class/backlight/acpi_video0/brightness

That's it ;)

Thanks to @Hevilath's answer and @user207402's answer and also @AiPdimi's answer