You are not logged in.

#1 2007-09-17 14:08:02

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Multimedia keys refering to X display. A bug of acpid?

Hello, I have a really strange problem. I am setting up the Multimedia Keys of my laptop, editing the /etc/acpi/handler.sh file. I have tested all the multimedia keys when I restart the acpid daemon on a xterm terminal, and all keys work perfectly.

But when I boot my pc, and I try to use the multimedia keys, graphical applications (like kazehakase webbrowser and audacious on my example) don't work. But terminal applications and commands, like mute, volume up/down, wireless, Touchpad... all of them works correctly.

To make them working I must do "/etc/rc.d/acpid restart" on a graphical console (yes, I must a graphical console like xterm or Eterm, if I do it in a Ctrl + Alt + 1 console, for example, it doesn't work). When I do it, all multimedia keys works correctly, but I found really painful and uncomprehensible all of that.

What's the matter? What can I do to make all graphical applications runned by a multimedia key without restarting acpid? Maybe a bug?

I join my /etc/acpi/handler.sh. Focus on hotkey part.

#!/bin/sh
# Default acpi script that takes an entry for all actions
# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

GOVERNOR="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
set $*

case "$1" in
    hotkey) #Focus on there for my problem
        case "$3" in
            0000006b) #TOUCHPAD ON/OFF - Working
            #SHMConfig must be enabled in xorg.conf
              PadOn=`synclient -l | grep -c "TouchpadOff.*0"`
              if [ "${PadOn}" = "1" ] ; then
                      synclient TouchpadOff=1
                      echo 1 > /proc/acpi/asus/mled
                      :#Enable Touchpad
                    else
                        synclient TouchpadOff=0
                        echo 0 > /proc/acpi/asus/mled
                        :#Disable Touchpad
                    fi
            ;;
            0000005f) #Wireless ON/OFF - Working
        #    LED=$(cat /proc/acpi/asus/wled)
                /etc/rc.d/autowifi stop 
                echo 0 > /proc/acpi/asus/wled
            ;;
            0000005e)
                /etc/rc.d/autowifi start
                echo 1 > /proc/acpi/asus/wled
            ;;
            00000051) #Run web browser - NOT Working on boot
                       echo "Kazehakase key pressed!">/dev/tty5    
                su davigetto -c kazehakase &
            ;;
            00000050)
                       su davigetto -c "kazehakase http://mail.google.com" &
            ;;
            00000045) #Run music player audacious - NOT Working on boot
                       su davigetto -c "audacious -t" &
            ;;
            00000041)
                       su davigetto -c "audacious -f" &
            ;;
            00000040)
                       su davigetto -c "audacious -r" &
            ;;
            00000043) su davigetto -c "audacious -s" &
            ;;
            00000032) amixer set Master toggle;; #MUTE volume - Working
            00000031) amixer set Master 1-;; #Volume down - Working
            00000030) amixer set Master 1+;; #Volume up - Working
            0000005c) #cpu-scaling hotkey - Working
                case "$GOVERNOR" in
                    ondemand)
                     echo "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo "powersave" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                    ;;
                    powersave)
                     echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo "performance" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                    ;;
                    performance)
                     echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                     echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                    ;;
                esac
                ;;
        esac
        ;;
    button/power)
        #echo "PowerButton pressed!">/dev/tty5
        case "$2" in
            PWRF)    logger "PowerButton pressed: $2" 
                halt;;
            *)    logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB) echo -n mem >/sys/power/state ;;
            *)    logger "ACPI action undefined: $2" ;;
        esac
        ;;
    
    ac_adapter)
        case "$2" in
            AC)
                case "$4" in
                    00000000)
                    #entrando en modo bateria
                        echo -n $minspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode start
                    ;;
                    00000001)
                    #entrando en modo AC
                        echo -n $maxspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode stop
                    ;;
                esac
                ;;
            *) logger "ACPI action undefined: $2" ;;
        esac
        ;;
    battery)
        case "$2" in
            BAT0)
                case "$4" in
                    00000000)    
                    #bateria no presente
                    #echo "offline" >/dev/tty5
                    ;;
                    00000001)    
                    #bateria presente
                    #echo "online"  >/dev/tty5
                    ;;
                esac
                ;;
            *) logger "ACPI action undefined: $2" ;;
        esac
        ;;

    button/lid)
        #echo "LID switched!">/dev/tty5
        ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

Greetings


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

Board footer

Powered by FluxBB