2

Note : I know this question is becoming quite common, but I'm afraid every solution I found failed to solve the problem. Maybe the knowledge-base we have about this is getting old, irrelevant for newest hardware components ?

My machine

Linux 3.8.0-33-generic #48~precise1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

I'm running Ubuntu 12.04 (Precise Pangolin) on a Sony VAIO, and the following AMD graphic card :

VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7550M/7570M/7650M]

Most of the solutions I found where meant for Nvidia graphics, which is why I'm getting quite limited...

The problem

Basically, I can't change my brightness level.

  • Using the GUI in Settings, All settings, Brightness and lock, I can "change" the brightness value, but nothing actually happens.
  • Using the Fn + F5/F6 keys triggers a desktop notification displaying the new brightness value, but still : nothing changes.

What I've tried

It's important to know that this problem hasn't been there forever. On my first Ubuntu install, everything was quite functional when it comes to brightness. Then, because I got quite bored of Ubuntu, I decided to switch to Arch Linux, and I'm now back on Ubuntu for my primary desktop machine. However now, setting the brightness is not possible anymore, which means I have to use my screen at full brightness everytime, even when I'm on battery...

As I said, I tried as many solutions as I was able to find :

  • I edited the GRUB_CMDLINE_LINUX GRUB setting, with acpi_osi=Linux. Files were created into /sys/class/backlight/acpi_video0 (actual_brightness, brightness and max_brightness), but even though their content changes as I set my brightness higher or lower, no change is effective.
  • Same thing, adding acpi_backlight=vendor. The /sys/class/backlight/acpi_video0 link/directory disappeared. Control keys do not trigger notifications anymore, and changing the setting using the GUI is no longer possible.
  • I tried using xbacklight. No error, but no changes.

Has anyone got any experience with those problems ?


Problem solved!

Here's the workaround I've made from S Prasanth's answer. Root terminal required.

In a /usr/bin/brightness_change file, I've placed this script :

#!/bin/bash

if [ $# -ne 1 ]; then
    echo "Usage: brightness_change [level]" > /dev/stderr
    exit 1
fi

if [ ! -w /sys/class/backlight/acpi_video0/brightness ]; then
    echo "Brightness settings are not available." > /dev/stderr
    exit 2
fi

TIMEOUT=4
endTime=$(($(date +%s)+$TIMEOUT))
while [ $(date +%s) -lt $endTime ]
do
    echo $1 | tee -a /sys/class/backlight/acpi_video0/brightness > /dev/null 2> /dev/null
done

This script will NOT always give a satisfying result. It usually has to be run several times before succeeding. Also, remember to set its rights and ownership correctly :

chown root:root /usr/bin/brightness_change
chmod 0755 /usr/bin/brightness_change

Now, in my /etc/sudoers file :

ALL ALL=NOPASSWD: /usr/bin/brightness_change

This way, anyone can execute sudo brightness_change without the need of a password.

For further improvements : you may want to connect this script to your ACPI events, in order to trigger a brightness change when your laptop goes on battery, on gets plugged-in.

Note : this problem seems to have been fixed in the newest versions of the driver, my hotkeys are now fully functional.

2
  • Have you installed the proprietary drivers for your graphic card? Sometimes, the problem is solved by simply installing the proprietary drivers. If it works, remember to undo all changes you made to grub.
    – Prasanth S
    Nov 27, 2013 at 9:14
  • I am already using the AMD (flgrx) proprietary drivers, just like I did on my previous install. Nov 27, 2013 at 16:47

1 Answer 1

1
+50

Mine's nvidia so nothing mentioned in this post is from first hand experience.

Apparently, this is an issue with the latest fglrx drivers in 12.04: Last couple of fglrx drivers on Ubuntu 12.04 have backlight support broken.


Workarounds:

  1. The guy who asked that question, in his first answer mentions that pressing and holding the brightness keys for a few seconds changes brightness - or at least toggles between the highest and lowest possible settings. See if this works.

  2. In the same answer, he's provided this link: https://bbs.archlinux.org/viewtopic.php?pid=1269560#p1269560 which provides a very weird workaround. Apparently, although writing to /sys/class/backlight/acpi_video0/brightness doesn't work, writing to the file very frequently for a short period of time works. The code snippet suggested in the link is:

    while :; do echo 10 > /sys/class/backlight/acpi_video0/brightness ; done

    in a root shell. You can terminate this while loop in a few seconds and apparently the brightness changes. If this works you can do the following:

Add the following lines to ~/.bashrc

function chbrightness {
    TIMEOUT=5
    endTime=$(($(date +%s)+$TIMEOUT))
    chbrightness_string="
        while [ \$(date +%s) -lt $endTime ]
        do
            echo $1 > /sys/class/backlight/acpi_video0/brightness
        done
    "
    sudo bash -c "$chbrightness_string"
}

Set TIMEOUT appropriately. To change brightness, simply run chbrightness <value> from terminal and provide the sudo password.


In his later answer, he mentions that a newer driver from the amd site partially fixes the issue. You may go ahead and install this or stick to the workaround (assuming it works) till the fixed drivers make it into the repositories.

1
  • Congratulations! Writing repeatedly to the brightness file does trigger a change. That's probably why holding the key does the trick (even though it didn't work for me). Those AMD developers will never stop surprising me... I'll see your workaround code, and write mine accordingly. Thanks ;) Nov 27, 2013 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.