Find the answer to your Linux question:
Results 1 to 5 of 5
Hello I am having a problem with the FN keys on a HP Probook 4320s and using archbang (arch + openbox). When I tried an ubuntu live cd the brightness, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer valemon's Avatar
    Join Date
    Oct 2006
    Location
    Volos
    Posts
    934

    FN keys not working


    Hello

    I am having a problem with the FN keys on a HP Probook 4320s and using archbang (arch + openbox).
    When I tried an ubuntu live cd the brightness, volume etc, worked just fine.
    Using xev I got this output while hitting the keys
    KeyRelease event, serial 40, synthetic NO, window 0x1800001,
    root 0x152, subw 0x0, time 1722303, (-375,141), root717,436),
    state 0x0, keycode 233 (keysym 0x1008ff02, XF86MonBrightnessUp), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
    Also when I echo a value in /sys/class/backlight/acpi_video0/brightness the brightness changes
    Can anyone help me with this?.
    Linux is like a Teepee, No Windows, No Gates, Only Apache Inside!
    Arch Linux
    Linux user #442041

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    GNOME and KDE both take care of mapping these keys for you, which is why Ubuntu (using GNOME) works out of the box. Openbox does not do this, you'll have to assign actions to the keys themselves. You can do this in the rc.xml file. (Should be at ~/.config/openbox/rc.xlm)

    For example, I use this script, saved as /usr/local/bin/vol.sh, to handle the volume keys.
    #!/bin/sh

    usage="usage: $0 -c {up|down|mute} [-i increment] [-m mixer]"
    command=
    increment=5%
    mixer=Master

    while getopts i:m:h o
    do case "$o" in
    i) increment=$OPTARG;;
    m) mixer=$OPTARG;;
    h) echo "$usage"; exit 0;;
    ?) echo "$usage"; exit 0;;
    esac
    done

    shift $(($OPTIND - 1))
    command=$1

    if [ "$command" = "" ]; then
    echo "usage: $0 {up|down|mute} [increment]"
    exit 0;
    fi

    display_volume=0

    if [ "$command" = "up" ]; then
    display_volume=$(amixer set $mixer $increment+ unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
    fi

    if [ "$command" = "down" ]; then
    display_volume=$(amixer set $mixer $increment- unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
    fi

    icon_name=""

    if [ "$command" = "mute" ]; then
    if amixer get Master | grep "\[on\]"; then
    display_volume=0
    icon_name="notification-audio-volume-muted"
    amixer set $mixer mute
    else
    display_volume=$(amixer set $mixer unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
    fi
    fi

    if [ "$icon_name" = "" ]; then
    if [ "$display_volume" = "0" ]; then
    icon_name="notification-audio-volume-off"
    else
    if [ "$display_volume" -lt "33" ]; then
    icon_name="notification-audio-volume-low"
    else
    if [ "$display_volume" -lt "67" ]; then
    icon_name="notification-audio-volume-medium"
    else
    icon_name="notification-audio-volume-high"
    fi
    fi
    fi
    fi
    notify-send " " -i $icon_name -h int:value:$display_volume -h string:synchronous:volume
    It uses Ubuntu's nice notification system, notify-osd.

    And then in rc.xml, I have
    Code:
    <keybind key="XF86AudioMute">
          <action name="Execute">
            <command>/usr/local/bin/vol.sh mute</command>
          </action>
        </keybind>
        <keybind key="XF86AudioRaiseVolume">
          <action name="Execute">
            <command>/usr/local/bin/vol.sh up</command>
          </action>
        </keybind>
        <keybind key="XF86AudioLowerVolume">
          <action name="Execute">
            <command>/usr/local/bin/vol.sh down</command>
          </action>
        </keybind>
    You could assign your brightness command to the XF86MonBrightnessUp key similarly.

  3. #3
    Linux Engineer valemon's Avatar
    Join Date
    Oct 2006
    Location
    Volos
    Posts
    934
    Thank you for your useful answers.
    I have managed to increase/decrease brightness by assigning the keys to scripts.
    I just have one last little problem. I am running a script that needs sudo and I have entered this line at the sudoers
    valemon ALL=(ALL) NOPASSWD: /usr/bin/brightness_control/brightnesscontrol.sh
    But still it requires password to run?
    I am soo close..
    Linux is like a Teepee, No Windows, No Gates, Only Apache Inside!
    Arch Linux
    Linux user #442041

  4. #4
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    I think a better method would be to change the ownership of /sys/class/backlight/acpi_video0/brightness to your user.
    Code:
    sudo chown valemon /sys/class/backlight/acpi_video0/brightness
    This would have to be done each boot, so I would put this in a script and run it from /etc/rc.local. (This runs as root, so you won't need the sudo.)

    Then you can avoid all the sudoer stuff.

  5. #5
    Linux Engineer valemon's Avatar
    Join Date
    Oct 2006
    Location
    Volos
    Posts
    934
    Thank you that did the trick ^^

    Problem solved I guess
    Linux is like a Teepee, No Windows, No Gates, Only Apache Inside!
    Arch Linux
    Linux user #442041

Posting Permissions

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