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

Thread: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

  1. #1
    Join Date
    Sep 2013
    Beans
    60

    ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    Update May 2014: The following also works in Lubuntu 14.04

    I have seen a few threads discussing difficulties using function keys to adjust the screen backlight brightness on certain ASUS laptops.
    I want to share what is working for me.

    laptop: ASUS N550JV
    gpus: integrated Intel gpu & NVIDIA GT 750M
    Lubuntu 13.10, 3.11.0-13-generic
    (I also have xfce4 and xfce4 metapackages installed, but the method described here was tested running in Lubuntu sessions)
    Drivers: Nvidia-319, Nvidia-prime

    As indicated above, this is a hybrid-gpu laptop.
    I am running nvidia-prime all the time (not worried about laptop power savings at the moment), so not trying to take advantage of Optimus technology power savings. Presumably, the video is generated by the Nvidia gpu, and the data the Nvidia gpu outputs is then transferred to the integrated Intel gpu, which displays it.

    my relevant grub settings from /etc/default/grub:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=\"!Windows 2012\""
    GRUB_CMDLINE_LINUX=""

    (I have found that using "!Windows 2012" in GRUB_CMDLINE_LINUX-DEFAULT, I gained the ability to use Fn+F2 to toggle the wireless radio* on/off, which I did not have when I was using acpi_os="")
    * it is an Intel wireless card, substituted for the Atheros that came with the laptop

    My /sys/class/backlight folder at default with the above setup contains 3 folders:
    /acpi_video0/
    /acpi_video1/
    /intel_backlight/

    The /sys/class/backlight/intel_backlight/ folder contains these 3 folders: /device/ /power/ /subsystem/
    and these files:
    actual_brightness
    bl_power
    brightness
    max_brightness
    type
    uevent

    My default setting for brightness was 5100
    and the max_brightness value seems to be 5273 (or so)

    First, I confirmed that I could control the screen brightness by changing the value stored at /sys/class/backlight/intel_backlight/brightness:

    Code:
    echo 1000 > /sys/class/backlight/intel_backlight/brightness
    When I issued this command as root, the screen dimmed. It then brightened back up after using echo to change the value back to 5100.

    So here is what to do:

    (1) Create two scripts, one to tell the Intel driver to dim the screen, and one to tell it to brighten the screen, acting in steps.

    /home/yourname/.scripts/screen_dimmer.sh
    /home/yourname/.scripts/screen_brighter.sh

    I placed the scripts in my home folder, within a /.scripts/ folder I have there.

    Make sure the scripts have permissions to be executed.

    Code:
    sudo chmod +x /home/yourname/.scripts/screen_dimmer.sh
    sudo chmod +x /home/yourname/.scripts/screen_brighter.sh
    Here are the scripts:

    screen_dimmer.sh script:
    Code:
    #!/bin/bash
    screenbrightness=$(cat "/sys/class/backlight/intel_backlight/brightness")
    makenow=$((screenbrightness-1000))
    
    if [ "$screenbrightness" -gt 100 ]
    then
    echo $makenow >> /sys/class/backlight/intel_backlight/brightness
    fi
    Code:
    #!/bin/bash
    screenbrightness=$(cat "/sys/class/backlight/intel_backlight/brightness")
    makenow=$((screenbrightness+1000))
    
    if [ "$screenbrightness" -lt 5100 ]
    then
    echo $makenow >> /sys/class/backlight/intel_backlight/brightness
    fi
    (I chose the increments/decrements to be 1000, giving about 5 steps, but you could probably increase the number of steps by using smaller values than 1000. You may also be able to lower the lowest level of brightness even further by changing the decrement value and by changing the 100 in the "-gt 100" expression to a lower value. I haven't tested this.)

    Add one line to the rc.local file that on every boot will give all users permission to change the file.
    the line is
    Code:
     chmod 666 /sys/class/backlight/intel_backlight/brightness
    the line goes right before the "exit 0" so that the file looks like this after the addition:

    Code:
    #By default this script does nothing
    
    chmod 666 /sys/class/backlight/intel_backlight/brightness
    exit 0
    (2) Next, it's necessary to remap the keyboard so that you can call up one of the scripts with the press of a key. To do this, we need to install xbindkeys and its configuration GUI, xbindkeys-config.

    Code:
    sudo apt-get install xbindkeys xbindkeys-config
    create a configuration file for xbindkeys and put a few default settings in it:
    Code:
    xbindkeys -d > /home/yourname/.xbindkeysrc
    Now launch the xbindkeys configuration GUI from a terminal:
    Code:
    xbindkeys-config
    a window will open
    click on "New" at the bottom

    choose a name for your function, and type that name in the box on the upper right under "Edit" in the space next to "Name:"
    This is just to remind you what this function does if you need to change things in the future.
    (for example, I chose "screen_dimmer" - without the quotes - for the name for lowering the backlight brightness)

    click on "Get Key" just slightly below where you typed the function name
    a window will open on the desktop
    press the key you want to assign the screen backlight lowering function to
    (I chose F5 on the top row of the keyboard, without the Fn key)

    next type the location of your script for lowering the screen brightness in the box next to "Action:", in the space where it says "Command"
    /home/yourname/.scripts/screen_dimmer.sh

    If you now click on Run Action, the screen should dim slightly, assuming there were no errors up to this point.

    click Apply, then click Save & Apply & Exit
    (you probably can get away with just clicking Apply and then directly going on to set the next key-binding instead of first clicking Save & Apply & Exit (which forces you to have to relaunch the GUI), but I haven't tried it that way)

    relaunch the configuration GUI with xbindkeys-config in the terminal (if necessary because you clicked Save & Apply & Exit in the last step)

    repeat the above steps for assigning a key to a function, this time choosing a name for the raising-the-screen-backlight-brightness function (I chose "screen_brighter"), and getting the key press that you want to activate that function (I chose F6, without the Fn key) and supplying the location of the script
    /home/yourname/.scripts/screen_brighter.sh

    then Apply,
    Save & Apply & Exit[/QUOTE]

    I realize this may not be the most efficient way to achieve the desired results, but it is at least better than nothing.

    edit: While testing this for 14.04, I found that I needed to change the permission on /sys/class/backlight/intel_backlight/brightness for the scripts to be able to access (write to) the file. I must have also done that for 13.10, but forgot to include it in the instructions.
    Last edited by Remten; May 18th, 2014 at 01:48 AM. Reason: also works in 14.04; corrected minor errors

  2. #2
    Join Date
    Sep 2013
    Beans
    60

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    A quick test shows that sending a value of 0 to the backlight controller will shut the screen light off:
    Code:
     sudo echo 0 >> /sys/class/backlight/intel_backlight/brightness
    That should be easy enough to implement in the screen backlight dimmer script.
    Or maybe even a separate keystroke sequence dedicated to turning the screen to black.

  3. #3
    Join Date
    May 2014
    Beans
    745

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    So what do you get if you enter in terminal cat /var/log/Xorg.0.log | grep backlight

  4. #4
    Join Date
    Sep 2013
    Beans
    60

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    Quote Originally Posted by jeremy31 View Post
    So what do you get if you enter in terminal cat /var/log/Xorg.0.log | grep backlight
    Code:
    Remten@linux:~$ cat /var/log/Xorg.0.log | grep backlight
    Remten@linux:~$
    Nothing.
    Why do you ask?

  5. #5
    Join Date
    May 2014
    Beans
    745

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    I have 4 different laptops, all have intel video on them

    Two of them return this from cat /var/log/Xorg.0.log | grep backlight and I haven't changed any settings

    found backlight control interface acpi_video0

    On one laptop, I put a file in /usr/share/X11/xorg.conf.d/ called 20-intel.conf and that file contains
    Section "Device" Identifier "Intel Graphics"
    Driver "intel"
    Option "Backlight" "intel_backlight" # use your backlight that works here
    Driver "intel"
    BusID "PCI:0:2:0"
    EndSection
    and the terminal command gives me
    [ 25.410] (**) intel(0): Option "Backlight" "intel_backlight"[ 25.411] (**) intel(0): found backlight control interface intel_backlight (type 'user')

    This machine also needed "acpi_backlight=vendor" in grub to keep it from booting at 0 brightness with kernel 3.11, this also removed the acpi_video0 from /sys/class/backlight/ and replaced it with thinkpad_backlight or something

    And with kernel 3.13 there is another option " video.use_native_backlight=1" that seems to work on some video cards.

    I probably have messed around looking for options in case my next laptop has issues, even created scripts like yours and bound the scripts to CTRL+UP-ARROW and CTRL+DOWN-ARROW just for the sake of testing.

    Do your attempts to use you original FN+ shortcuts registering anything in dmesg?

  6. #6
    Join Date
    Sep 2013
    Beans
    60

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    Quote Originally Posted by jeremy31 View Post
    Do your attempts to use you original FN+ shortcuts registering anything in dmesg?
    I don't know how to use dmesg to check. (And am too worn out at this point to play around with the current configuration to see.) However, I can tell you what I got when I scanned keypresses with xev when I was initially trying to get the Fn keys working (back with lubuntu 13.10, kernel 3.11), according to my notes:

    key
    keycode keyscan state* acpi_listen
    F5 71 0xffc2, F5 nothing ^[[15~
    Fn+F5 nothing nothing nothing nothing
    F6 72 0xffc3, F6 nothing ^[[17~
    Fn+F6 nothing nothing nothing nothing
    The <Fn> key pressed by itself didn't register anything.

    *By comparison, pressing pressing Fn+F8 triggered a "state" of "XF86TouchpadToggle"

  7. #7
    Join Date
    May 2014
    Beans
    745

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    I would want to talk to sandman007 from this thread http://rog.asus.com/forum/showthread...tness-In-Linux

    You might see something with dmesg | tail in terminal after trying a FN+ combo that isn't recognized

    And you could check the hidden file .xsession-errors in your home directory
    Last edited by jeremy31; May 18th, 2014 at 10:35 PM.

  8. #8
    Join Date
    May 2014
    Beans
    745

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    What do you get from xinput in terminal? Actually you just need the ID of the virtual core keyboard, mine was 3 so I used xinput --test-xi2 3 to see the results of the FN+ keypresses

  9. #9
    Join Date
    Sep 2013
    Beans
    60

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    Quote Originally Posted by jeremy31 View Post
    What do you get from xinput in terminal? Actually you just need the ID of the virtual core keyboard, mine was 3 so I used xinput --test-xi2 3 to see the results of the FN+ keypresses
    With cursor moved to random place on the screen:

    <F5> produces
    event type: 13 (RawKeyPress)
    device: 3 (14)
    detail: 71
    valuators:

    <Fn><F5> produces
    nothing

    .xsession-errors shows no relevant errors (and doesn't change with the key presses)

  10. #10
    Join Date
    May 2014
    Beans
    745

    Re: ASUS N550JV laptop screen backlight adjustment (lubuntu 14.04 & 13.10)

    dmesg | grep unknown or dmesg | tail might show a report after an unknown keypress

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •