If you have a laptop with Intel graphics and broken backlight control…

e.g. a Sony Vaio Y-series, where upon seeing the debugging data kernel developer Matthew Garrett (mjg) pronounced it “what an awful implementation — utterly broken”, there is hope yet.

Matthew has been working on native backlight control for a while, and for Intel hardware, there’s currently only one patch left to merge onto Linus’ kernel tree; it applies cleanly onto the most recent kernel release candidate (3.0-rc7).

Unfortunately, by default the ACPI subsystem will still be used if available, which is the sensible default. You do want to use the predefined backlight values whenever possible, not the raw values the graphics card let you set.

Ubuntu users have been resorting to Kamal Mostafa’s linux-kamal-mjgbacklight repository, which enables native backlight control, disable the ACPI video driver, and provide a patched GNOME Power Manager that can interface with the native backlight control.

The workaround I came up with is more lightweight — it just uses inotify-tools to monitor the brightness file, and apply an appropriate equivalent value to the native backlight control. Feel free to use this if you’re affected by a similar problem.

About these ads

35 responses to “If you have a laptop with Intel graphics and broken backlight control…

  1. Hi,

    I am running Ubuntu Oneiric, standard distribution kernel, on a Dell Inspiron 640m. The graphics card is an Intel 945GM.

    * lspci extract :
    00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
    00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
    * uname -a :
    Linux arwen 3.0.0-16-generic #29-Ubuntu SMP Tue Feb 14 12:49:42 UTC 2012 i686 i686 i386 GNU/Linux

    My backlight control seems to be broken. Problem description : the function keys make huge leaps from max to min, or min to max (3 steps instead of 8). Surprisingly the xbacklight command, used in a console, works correctly.

    Despite what I read on Kamal Mostafa launchpad repository, adding “acpi_backlight=vendor” to the boot parameters does yield a better result. So I decided to give your script a try :-)

    Well, running it as a non-root user, I get permissions errors. Normal. But running it as root (via sudo) returns me these errors for a single function keypress :
    ./sync-acpi-intel.sh: ligne 58 : echo: erreur d’écriture : Argument invalide
    ./sync-acpi-intel.sh: ligne 58 : echo: erreur d’écriture : Argument invalide

    That’s weird as the brightness file is present :
    fabrice@arwen:~$ ls -1 /sys/class/backlight/intel_backlight
    actual_brightness
    bl_power
    brightness
    device
    max_brightness
    power
    subsystem
    type
    uevent

    I would be grateful for any idea which would improve the situation…

    Thanks !

    PS : this is a regression as in a previous ubuntu distribution (but can’t remember which one) the function keys were adjusting the brightness correctly.

    • Not sure why the script fails — most of the time, when the scripts I write fail on Ubuntu it’s because I had bash-isms in it but use /bin/sh (which works if /bin/sh is actually Bash but not when it’s Dash like in Ubuntu), but here the script actually uses Bash anyway. You can perhaps try editing that line and not redirecting the echo output, so you can at least see what’s being outputted?

  2. Um, never mind. After posting, I did some more tests and the problem is not at the kernel level (which one could suppose with the behavior of the xbacklight command) : When I am logged into the recovery console, the brightness keys behave correctly.

    So there is something in the GUI interfering with the backlight control. It looks like keypresses are counted double or something like that.

    Still don’t know who is responsible for that so if you have any idea…

    • Kamal probably knows better than I do — most of the Ubuntu systems I manage are headless servers :) I’m mostly a Fedora person on laptops.

  3. Still struggling. :-)

    Even more weird, whether in gnome, unity or cinnamon, I have the same strange thing :
    – when the focus is on the desktop, or any other application window, the brightness skip steps like related above
    – when the application menu or the unity/gnome lenses are opened, ths brightness does not skip steps.
    It must have to do with the way keyboard events are captured and interpreted, but I can’t go much further on my own. I need some advice now.

    Looks finally like your script won’t be helpful to me. Anyway, thanks for your answers and time. I’m gonna try a post on ubuntu forums ; may be some specialist there can get me going.

    • Yes, mine is only useful in systems where the acpi_video0 interface is totally ignored. While I’m curious as to what causes the errors you see running it, I’m sure you have better things to do (like getting the backlight control working!)

      Do you see the problem on every desktop, or just Unity? Might help localize the problem to either something in X generally, or a specific desktop (Unity, GNOME, KDE…)

      • Every desktop, not only unity. But not in the recovery console, if one call also ‘X’ such a thing ;-)

        With sudo showkey I observe that the brightness keys are considered pressed/released twice whether only once.

        fabrice@arwen:~$ sudo showkey
        le mode clavier était RAW
        [ si vous essayez cela sous X Window, cela peut ne pas fonctionner
        étant donné que le serveur X utilise également /dev/console ]

        appuyer sur n’importe quelle touche (le programme terminera 10s après la dernière touche enfoncée)…
        code clavier 28 relâcher % Enter release after launching showkey
        code clavier 57 appuyer % space pressed
        code clavier 57 relâcher % space released
        code clavier 224 appuyer % brightness-down pressed
        code clavier 224 relâcher % brightness-down released
        code clavier 224 appuyer % ???
        code clavier 224 relâcher % ???

        Making progress, but still looking for what is doubling the key press/release event. I’m going to have a look into the bios.

  4. thanx guy, after a few tweaks to make it work with my acer aspire 7715z laptop worked great

    my multiplier number is a lot hier then 500 some around 73695 lol

    cat /sys/class/backlight/intel_backlight/max_brightness
    736950

    then changed the line that sets the backlight value into intel_backlight/brightness
    INTEL_BRIGHTNESS=$((INTEL_MAX-(MULTIPLIER*(BRIGHTNESS+1))))
    and set the script to write 0 for the britest setting, my intel backlight is backwords.

  5. Some people known as Nikon one V1 a conveyable DSLR the place you are able
    to just slip correct by way of your pocket but its shooting
    strength is identical as that of a DSLR. Samsung M620 Black
    mobile is just big enough to display four icons side by side
    and measures only 1. Whenever you rent a book from them, they plant a tree to show the benefits of renting books.

  6. Stop taking Meridia immediately if allergic reactions or seizures occur and notify a doctor immediately.

    And with good reason because sometimes running an app on the big
    screen is nothing short of magical. This tablet is more attractive and charming
    for internet users and enjoy everywhere with
    your family and friends.

  7. Howdy! This blog post couldn’t be written any better! Looking through this post reminds me of my previous roommate! He continually kept talking about this. I most certainly will send this information to him. Fairly certain he’ll have a very good read.
    Many thanks for sharing!

  8. Thank you for any other informative web site. The place else may I get that kind of info written in such an
    ideal method? I have a challenge that I am simply now operating on, and
    I’ve been at the look out for such info.

  9. It’s actually very complicated in this full of activity life to listen news on TV, so I simply use internet for that purpose, and take the most up-to-date information.

  10. First of all I would like to say great blog! I had a quick question that
    I’d like to ask if you do not mind. I was curious to know how you center yourself and clear your mind prior to writing. I have had a difficult time clearing my mind in getting my ideas out. I truly do enjoy writing however it just seems like the first 10 to 15 minutes are usually wasted just trying to figure out how to begin. Any ideas or tips? Many thanks!

  11. What i don’t understood is if truth be told how you’re now
    not really much more neatly-favored than you might
    be right now. You’re very intelligent. You already know therefore considerably in relation to this matter, produced me in my opinion consider it from so many varied angles. Its like men and women aren’t
    involved unless it is something to do with Lady gaga!
    Your own stuffs great. Always handle it up!

  12. The experience: I had to have someone come in to set up my computer,.
    Remove and dispose of moldy material in plastic bags, if possible.
    ” Equipment that is used to measure the saturation of moisture.

  13. There are many people moving on with the art of photography in the right
    manner. Once decided on the things to bring, start packing.
    Make sure you get a decent resolution LCD with any camera in this category.

  14. The experience: I had to have someone come in to set up my computer,.
    Here are 10 easy steps you can take to lower
    your exposure to tree pollen and other spring allergens, and keep allergy symptoms under control.
    The odor can smell like moldy must or worse than that.

  15. I love your blog.. very nice colors & theme.
    Did you create this website yourself or did you hire someone to do it
    for you? Plz respond as I’m looking to create my own blog and would like to know where u got this from. kudos

    muscle building

  16. You can definitely see your skills in the article you write.

    The arena hopes for even more passionate writers such
    as you who aren’t afraid to say how they believe. Always go after your heart.

    5htp

  17. Hi there, I think your site could be having internet browser compatibility problems.
    When I take a look at your web site in Safari, it looks fine
    but when opening in IE, it’s got some overlapping issues. I just wanted to provide you with a quick heads up! Apart from that, excellent website!

    online careers

  18. Excellent beat ! I would like to apprentice while
    you amend your site, how could i subscribe for a blog website?
    The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright
    clear concept

  19. Good post. I learn something totally new and challenging on websites I stumbleupon
    on a daily basis. It will always be useful to read articles from other writers and practice a little something from their websites.

  20. Hello would you mind sharing which blog platform you’re working with? I’m going to start my own blog in the near future but I’m having a hard time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I’m
    looking for something unique. P.S Sorry for getting off-topic
    but I had to ask!

  21. Very great post. I just stumbled upon your weblog and wished to say that
    I’ve really enjoyed surfing around your blog posts. In any case I will be subscribing in your rss feed and I am hoping you write once more soon!

  22. Fantastic beat ! I would like to apprentice while you amend your web site, how can i subscribe for a
    weblog website? The account helped me a applicable deal.
    I had been a little bit familiar of this your broadcast offered bright transparent
    idea

  23. Hi, i read your blog occasionally and i own a similar one
    and i was just curious if you get a lot of spam responses?
    If so how do you stop it, any plugin or anything you can suggest?

    I get so much lately it’s driving me insane so any support is very much appreciated.