Home > Ubuntu > Ubuntu 12.10 Screen Brightness on Sony VAIO T15

Ubuntu 12.10 Screen Brightness on Sony VAIO T15

March 3rd, 2013

I recently picked up a new Sony VAIO T15 ultrabook laptop. A really nicely designed laptop for a good price. After repartitioning, I was able to install Ubuntu 12.10 in a dual-boot arrangement fairly easily and Ubuntu worked well out of the box. However, screen brightness controls using Gnome power manager did not work out of the box and I had to to some hacking to get at least a bit of control.

Background

Normally, the backlight brightness is controlled via the /sys/class/backlight/acpi_video0 ACPI interface. However, the Intel video driver installs its controls as /sys/class/backlight/intel_backlight. This mismatch causes Gnome power management to fail to operate on this laptop.

Short-term Solution

While there are a number of different potential solutions on the internet, I was unable to get any of those to work as-is. The closest I came was with the solution list here. However, the keyboard shortcuts didn’t seem to work. Using those scripts, I was able to roll my own solution.

Scripts

Based on the solution listed above, I created two script files.

~/bin/brightdown.sh

#!/bin/bash

curr=`cat /sys/class/backlight/intel_backlight/actual_brightness`
if [ $curr -gt 0 ]; then
curr=$((curr-610));
echo $curr > /sys/class/backlight/intel_backlight/brightness;
fi

~/bin/brightdown.sh

#!/bin/bash

curr=`cat /sys/class/backlight/intel_backlight/actual_brightness`
if [ $curr -lt 4882 ]; then
curr=$((curr+610));
echo $curr > /sys/class/backlight/intel_backlight/brightness;
fi

Note that I placed these scripts in my personal bin folder rather than /etc/acpi. Each of the scripts must also be made executable.

Root Access When Necessary

Writing to the ACPI interface in the /sys folder requires root access. In order to avoid having to use su or sudo with a password in order to invoke these commands, the sudoers file can be configured to allow root execution without password for just these commands.

Using the visudo command, alter the sudo file as follows:


username ALL=NOPASSWD: /home/username/bin/brightdown.sh
username ALL=NOPASSWD: /home/username/bin/brightup.sh

where username is the name of the user to be given root access without a password to those commands.

Keyboard Shortcuts

As I was unable to get the standard keyboard shortcuts to work correctly with any of the suggested, I chose instead to create my own keyboard shortcuts. After installing, autokey, I was able to create my own shortcuts for decreasing and increasing the brightness using the above scripts. In my case, I chose Ctrl+Shift+- to decrease the brightness and Ctrl+Shift++ to increase the brightness.

Using the autokey application, choose New -> Script. Enter the name “Brightness Down”. Enter the command:

system.exec_command("sudo /home/username/bin/brightdown.sh")

and set the Hotkey to Ctrl+Shift+-.

Decrease Brightness

Autokey set up to decrease brightness

Do the same for increase the brightness, using the other script file.

Longer Term Solution

There is some hope according to Ubuntu Bug 954661 that this problem will be fixed via a kernel fix in the upcoming 13.04 Ubuntu release. If that happens, I will be able to remove these simple workaround. For the short-term though this works reasonably well. The primary missing feature is auto-dimming the screen for power savings.

Categories: Ubuntu Tags:
Comments are closed.