Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Acer laptop backlight + KMS workaround

  1. #1
    Join Date
    Jun 2007
    Beans
    13

    Acer laptop backlight + KMS workaround

    UPDATE: This works on Ubuntu 9.10 Karmic, 10.4 Lucid and 10.10 Maverick

    Also works on other brands of laptops!

    If you are like me, suffered for no KMS hack to make laptop backlight work, you can use the following method to bring KMS AND backlight adjusting together.

    First, thanks for the post https://bugs.launchpad.net/ubuntu/+s...ux/+bug/397617 to give me the idea to create a daemon script which continously monitor system level backlight value change and propagate the value to the pci bus to get it REALLY changed.

    1. Remove the 'nomodeset' hack from grub kernel loading parameter, now you cannot adjust backlight, for a while

    2. Restart system, open terminal and type this command:

    ~$ lspci | grep VGA

    00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)


    This number "00:02.0" is what you want to modify in the following script.

    3. Copy the lines between the "###" mark, and save it as a file named something like 'backlight_d.sh', before saving, modify the number after pciset -s ##:##.# as the one you got from step 2

    ~$ gedit ./backlight_d.sh

    ################################################## ######
    #!/bin/bash

    old_b=9;
    declare -i curr_b=240;
    declare -i target_b=240;

    while : ; do
    b=`cat /sys/class/backlight/acpi_video0/brightness`;
    delay="0.5"

    if [ $old_b != $b ]; then
    old_b=$b
    let "target_b=$b * 20 + 12"
    #printf "Target: %10d\n" $target_b
    fi

    hex_b=".";

    if [ "$curr_b" -lt "$target_b" ] ; then
    let "curr_b=$curr_b + 2"
    if [ "$curr_b" -gt "$target_b" ] ; then
    let "curr_b=$target_b"
    fi

    hex_b="-"
    elif [ "$curr_b" -gt "$target_b" ] ; then
    let "curr_b=$curr_b - 2"
    if [ "$curr_b" -lt "$target_b" ] ; then
    let "curr_b=$target_b"
    fi

    hex_b="-"
    fi

    if [ $hex_b != "." ] ; then
    hex_b=`printf "%02X" $curr_b`
    delay="0.005"
    setpci -s 00:02.0 F4.B=$hex_b
    fi

    sleep $delay
    done
    ################################################## ######

    4. Copy it to /etc (in root mode) and make executable
    # cp ./backlight_d.sh /etc/
    # chmod +x /etc/backlight_d.sh

    5. Add it to rc.local
    # nano /etc/rc.local

    Find the line 'exit 0', add BEFORE it:

    ################################################## ######

    nohup /etc/backlight_d.sh &

    ################################################## ######


    All done! Restart now and watch the backlight magically change!

    UPDATE: I've modified the first post to include the latest update of the script, which offers smooth transition of backlight level.
    Last edited by FunkyRider; October 14th, 2010 at 03:37 AM.

  2. #2
    Join Date
    May 2010
    Location
    Germany
    Beans
    1
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Acer laptop backlight + KMS workaround

    @FunkyRider
    It looks like the modification in rc.local is blocking the execution of bootchart.
    I've added the "&"-sign behind the script name and now bootchart works again as desired:
    BEFORE: nohup /etc/backlight_d.sh
    AFTER: nohup /etc/backlight_d.sh &

    (See also http://en.wikipedia.org/wiki/Nohup, section Example)

    Best regards

  3. #3
    Join Date
    Jul 2010
    Beans
    1

    Re: Acer laptop backlight + KMS workaround

    Thanks a tonne this seemed to work for me except when I boot into windows I am dual booting I can restart and go straight into ubuntu and it keeps working but as soon as I go into windows and then back to ubuntu it stops working any ideas

  4. #4
    Join Date
    Jan 2010
    Beans
    6

    Re: Acer laptop backlight + KMS workaround

    Thanks for this solution, this one has bugged my for some time. I modified your script some, because setpci writes hex values into the the hardware registers and with your solution, you never get back to the maximum of 0xFF brightness, instead only to 0x99, because the /sys/class/backlight/acpi_video0/brightness file, at least on my Acer Extensa 5635z with kubuntu karmic, contains only values from zero to nine. Here is my modified script:

    #################################
    #!/bin/sh

    old_b='9';

    while : ; do
    b=`cat /sys/class/backlight/acpi_video0/brightness`;

    if [ $old_b != $b ]; then
    #echo "Screen brightness level change: $old_b - $b"
    case $b in
    0) hex_b=1e ;;
    1) hex_b=37 ;;
    2) hex_b=50 ;;
    3) hex_b=69 ;;
    4) hex_b=82 ;;
    5) hex_b=96 ;;
    6) hex_b=b4 ;;
    7) hex_b=cd ;;
    8) hex_b=e6 ;;
    9) hex_b=ff ;;
    *) hex_b=ff ;;
    esac
    old_b=$b
    #echo "executing setpci -s 00:02.0 F4.B=$hex_b"
    setpci -s 00:02.0 F4.B=$hex_b
    fi

    sleep 0.5
    done
    #################################

    I started from the max brightness level 255 (0xFF) and went down in steps of 25 (0x19) to a min of 30 (0x1E). The stepping could of cause be choosen more or less steep and instead of the case instruction, some calculating formula would be possible, too.

    Greetings, and once again thanks for your help
    Skildron
    Last edited by Skildron; July 27th, 2010 at 09:24 AM. Reason: Disabled smilies

  5. #5
    Join Date
    Jun 2007
    Beans
    13

    Re: Acer laptop backlight + KMS workaround

    Been a while and just installed 10.10, thought I should make an update here.

    The KMS+Backlight is STILL BROKEN on 10.10. It's probably the BIOS which is broken and I can't find any newer BIOS of this model from Acer.

    The good news is this workaround still works on 10.10 so you can basically follow the step and fix it on 10.10.

    Also thanks for the '&' part and updated script, they indeed makes the workaround seems more polished.

  6. #6
    Join Date
    Jun 2007
    Beans
    13

    Re: Acer laptop backlight + KMS workaround

    Here is the ultimate backlight script:

    What it does is it smoothly transit between brightness levels (like MacBook if you've ever experienced it). However I suspect that it only works if you have LED backlight screens but not sure about it.

    Please try and give feedback!

    ###########################################

    #!/bin/bash

    old_b=9;
    declare -i curr_b=240;
    declare -i target_b=240;

    while : ; do
    b=`cat /sys/class/backlight/acpi_video0/brightness`;
    delay="0.5"

    if [ $old_b != $b ]; then
    old_b=$b
    let "target_b=$b * 20 + 12"
    #printf "Target: %10d\n" $target_b
    fi

    hex_b=".";

    if [ "$curr_b" -lt "$target_b" ] ; then
    let "curr_b=$curr_b + 2"
    if [ "$curr_b" -gt "$target_b" ] ; then
    let "curr_b=$target_b"
    fi

    hex_b="-"
    elif [ "$curr_b" -gt "$target_b" ] ; then
    let "curr_b=$curr_b - 2"
    if [ "$curr_b" -lt "$target_b" ] ; then
    let "curr_b=$target_b"
    fi

    hex_b="-"
    fi

    if [ $hex_b != "." ] ; then
    hex_b=`printf "%02X" $curr_b`
    delay="0.005"
    setpci -s 00:02.0 F4.B=$hex_b
    fi

    sleep $delay
    done

  7. #7
    Join Date
    Jun 2007
    Beans
    13

    Re: Acer laptop backlight + KMS workaround

    Bump...

    Really sad to see that not a lot of people try it and all following other inferior workarounds.

  8. #8
    Join Date
    Nov 2006
    Beans
    215

    Re: Acer laptop backlight + KMS workaround

    Didn't work for me, Lenovo Y450, was hoping it might as it would resolve one of my two main issues with 10.10 (that and Suspend sometimes not working) I'm back to using nomodeset and acpi_backlight=vendor in 10.04.

  9. #9
    Join Date
    Sep 2010
    Beans
    14

    Re: Acer laptop backlight + KMS workaround

    Workaround works on eMachines e527.
    Nice work(around), FunkyRider!

  10. #10
    Join Date
    Sep 2009
    Beans
    23

    Re: Acer laptop backlight + KMS workaround

    I have a emachine E527 also but it hasn't worked for me, when executing the script manually I get the below output.

    sudo ./backlight_d.sh
    [sudo] password for christina:
    ./backlight_d.sh: 6: declare: not found
    ./backlight_d.sh: 7: declare: not found
    ./backlight_d.sh: 44: let: not found

    Any advice to get this working please?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •