Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Dec 2014, 16:07
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
busybox acpid
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Fri 01 Jun 2012, 16:47    Post_subject:  busybox acpid  

Good day !

After examinig busybox acpid i have these two scripts :

1) /etc/init.d/bb_acpi
2) /etc/acpi/PWRF/00000080

Busybox acpid was introduced with version 1.14 and had major changes from 1.17 to 1.18 .

What i still not had getting finished is the syntax for the /etc/acpid.conf and /etc/acpid.map files .

Busybox acpid changes to /etc/acpi directory and if the Power Button is pressed, triggers the file ./PWRF/00000080 .

The directory /proc/acpi/button/PWRF at my desktop pc gets apparently created by the button.ko module .

At my netbook i have only the directory LID inside /proc/acpi/button directory , though button.ko module is loaded .

Closing the LID does not do anything for now, i think the busybox source has a LID0 line .


So here's the /etc/init.d/bb_acpi script to start busybox acpid at bootup :
Code:
#!/bin/sh
# Karl Reimer Godt in June 2012
# usual Puppy license
Version='1.0 Puppy_Linux_Racy_5.3 KRG'

usage(){
MSG="
$0 [start|stop]
Starts busybox acpid daemon at boot and
shuts it down at reboot or poweroff event.
"
if [ "$2" ];then
MSG="$MSG

$2
"
fi
echo "$MSG"
[ "$DISPLAY" ] && xmessage -bg blue3 "$MSG"
exit $1
}

ACPID_BIN=`which acpid`
[ "$ACPID_BIN" ] || usage 1 "No (executable) acpid binary installed?"
[ "`readlink "$ACPID_BIN" | grep -i 'busybox'`" ] || usage 1 "$0: Laucher for busybox acppid applet."

Config_directory=/etc/acpi       # -c
proc_event_file=/proc/acpi/event # -e
Log_file=/var/log/acpid.log      # -l
#acpid: invalid option -- 'p'
#BusyBox v1.19.3 (2011-11-09 07:34:50 WST)
Pid_file=/var/run/acpid.pid      # -p
Action_file=/etc/acpid.conf      # -a
Map_file=/etc/acpi.map           # -M

case $1 in
help) usage 0;;
version) echo -e "$0: Version '$Version'\nTry help for more info.\n";exit 0;;
start)
if pidof acpid ;then
echo "acpid Already running."
else
acpid -c "$Config_directory" \
 -e "$proc_event_file" \
 -l "$Log_file" \
 -a "$Action_file" \
 -M "$Map_file"

sleep 2
echo -n "Started acpid:"
pidof acpid || echo "FAILED."
fi
;;
stop)
if pidof acpid;then
 for n in {1..4};do
 kill -$n `pidof acpid`
 sleep 1
 pidof acpid || break
 done
   if [ -f "$Pid_file" ];then
   pid_file_pid=$(cat "$Pid_file")
   [ "$pid_file_pid" ] || pid_file_pid=999999999999999 #fake, hopefully never used :oops:
   if ps | grep -w "$pid_file_pid";then
    for n in {1..4};do
      kill -$n `pidof acpid`
      sleep 1
      pidof acpid || break
     done
   fi
   fi
  if pidof acpid;then
   echo "FAILED to stop acpid."
  else
   echo "acpid stopped."
  fi
else
echo "acpid not running."
fi
rm -f "$Pid_file"
;;
"") usage 1 "Need Parameter.";;
*) usage 1 "Unknown Parameter '$1' .";;
esac


And this is /etc/acpi/PWRF/00000080 trigger script :
Code:
#!/bin/sh
# Karl Reimer Godt in June 2012
# usual Puppy license
Version='1.0 Puppy_Racy_5.3 KRG'

usage(){
MSG="
$0 [help]
Script to suspend or hibernate
called by busybox applet 'acpid'.
Busybox acpid since version 1.18 needs
the 'evdev' kernelmodule loaded , but
seems not to need the 'button' module.
Works only with the Powerbutton,
not with closing the lid.
Please don't call busybox applets with
'busybox appletname' . Closing commands like
kill could accidentaly kill busybox init, which
would result in immedeate reboot. Always call it with
the [/path/to/link/]appletname.

Uses acpitool if installed, otherwise the
simple 'echo \"\$state\" >/sys/power/state' .

Full acpid pkg available : unknown.
"
if [ "$2" ];then
MSG="$MSG

$2
"
fi
echo "$MSG"
[ "$DISPLAY" ] && xmessage -bg blue3 "$MSG"
exit $1
}
case $1 in
help) usage 0;;
version) echo -e "$0: Version '$Version'\nTry help for more info.\n";exit 0;;
"") :;;
*) usage 1 "Unknown Parameter '$1'";;
esac

loop_umount_func(){
M_LOOP=`mount | grep '/dev/loop' |grep -v '/initrd'`
M_LOOP=`echo $M_LOOP |rev|sed 's!)!\n)!g'|rev`
M_LOOP=`echo "$M_LOOP" |grep -o ' on .* type ' |sed -r 's!( on )(.*)( type )!\2!'`
for mloop in $M_LOOP;do
umount $mloop
[ $? -ne 0 ] && { xmessage -bg red2 "Please umount '$mloop' manually and try again";exit 0; }
done
}

part_umount_func(){
M_DEV=`mount | grep '/dev/[shfmd]+[0-9]' |grep -v '/initrd'`
M_DEV=`echo $M_DEV |rev|sed 's!)!)\n!g'|rev`
M_POI=`echo "$M_DEV" |grep -o ' on .* type ' |sed -r 's!( on )(.*)( type )!\2!'`
M_DEV=`echo "$M_DEV" |grep -o '.* on ' |sed 's!(.*)( on )!\1!'`
for mpart in $M_POI;do
umount $mpart
[ $? -ne 0 ] && { xmessage -bg red2 "Please umount '$mpart' manually and try again";exit 0; }
done
}

restore_mounts(){
for part in $M_DEV;do
FS_TYPE=`guess_fstype $part`
dirn=${part##*/}
mkdir -p /mnt/$dirn
mount -t $FS_TYPE $part /mnt/$dirn
done
}

ACPITOOL=`which acpitool`
states_avail=`cat /sys/power/state`
states_avail=`echo "$states_avail" |tr ' ' '\n'|sed 's!disk!S4 Hibernation:disk!;s!mem!S3 PM_SLEEP:mem!'`

aplay /usr/share/audio/2barks.au
xmessage -bg red1 "$0
Available states:
$states_avail
"

xmessage -buttons "HIBERNATE On DISK:204,RAM SLEEP:203,ESCAPE GUI:200" -bg blue3 "Busybox acpid :
Do you want to go into ACPI PM SLEEP mode ?"
ANSWER=$?

if [ "$ANSWER" = 200 ];then
:

elif [ "$ANSWER" = 203 ];then

loop_umount_func
part_umount_func
sync
sleep 1

   if [ "$ACPITOOL" ];then

      acpitool -s
   else
echo 'mem' >/sys/power/state
   fi

restore_mounts



elif [ "$ANSWER" = 204 ];then

loop_umount_func
part_umount_func
sync
sleep 1

   if [ "$ACPITOOL" ];then
   PROC_SWAPS=`cat /proc/swaps |sed '1d'|awk '{print $1}'`
      for swap in $PROC_SWAPS;do
       RESUME=`blkid $swap |grep -iE 'Winter|Hiber|Resume'`
       [ "$RESUME" ] && break
      done
    if [ ! "$RESUME" ];then
    FDISK_SWAPS=`fdisk -l |grep -i swap|awk '{print $1}'`
      for swap in $FDISK_SWAPS;do
       RESUME=`blkid $swap |grep -iE 'Winter|Hiber|Resume'`
       [ "$RESUME" ] && break
      done
    fi
      if [ "$RESUME" ];then
         for swap in $PROC_SWAPS;do
      [ "$swap" = "$RESUME" ] && continue
      swapoff $swap
         done
      swapon $RESUME
      fi

      sync
      sleep 1
      acpitool -S

      sleep 1
      for swap in $PROC_SWAPS;do
      swapon $swap
      done
      if [ "$RESUME" ];then
       if test cat /proc/swaps |sed '1d' |wc -l -gt 1;then
        swapoff $RESUME
       fi
      fi

   else #acpitool
echo 'disk' >/sys/power/state
   fi

restore_mounts

else
:
fi

sleep 5
case $ANSWER in
203)
xmessage "RETURNED from RAM light sleep"
;;
204)
xmessage "RETURNED from DISK winter sleep"
;;
*) :;;
esac

exit 0

Note 1:
The Hibernate choice should not work with stock Puppy kernels by BK because hibernation is unfortunately not enabled by him . Others like Saluki and Dpup Exprimo i guess should be able to hibernate .

Note 2:
I started to have two swap partitions : one normal swap and one reserved for hibernation . I have labeled one Swap Partition "Resume" and blkid should find it, and use it, even if it is not primary first swap in /proc/swaps file or not mounted by rc.sysinit .

Note 3:
On my installations the code looks different everywhere, so likely the code i posted has bugs .

Note 4:
It seems that starting /etc/init.d/bb_acpi does start the daemon but it seems not to work as it should. Starting "/etc/init.d/bb_acpi start" works for me from terminal .
[EDIT]
OK found the cause :
Starting acpid before Xorg the DISPLAY variable is not exported system wide yet. Though /etc/acpi/PWRF/00000080 gets executed later while X is running, acpid does export a NULL DISPLAY variable to 00000080 . It is also a matter of login : The DISPLAY variable gets only exported for the current logged in person, normally "root" , so login spot or fido in rxvt terminal would not give a DISPLAY variable to them and a simply 'xmessage "HELLO"' would not work that way either. If i want a dialog GUI for choosing the SLEEP MODE pressing the Power Button of a machine, I need to launch /etc/init.d/bb_acpi from /root/.xinitrc or /usr/sbin/delayedrun . I have chosen to make /etc/init.d/bb_acpi non-executable, so it would not get launched by /etc/rc.d/rc.services and put in a line in /root/.xinitrc :
Code:
--- /initrd/pup_ro2/root/.xinitrc   2010-11-07 03:32:29.000000000 +0100
+++ /root/.xinitrc   2012-06-02 12:11:08.242407245 +0100
@@ -71,6 +71,7 @@ if [ -f /etc/xrandrindex ];then
   fi
 fi
 
+source /etc/init.d/busybox_acpid start
 
 if [ -f /root/.xset.sh ];then
  #this is created by /usr/bin/pupx...

[/EDIT]

Note 5:
It only works with pressing the Power Button of the machine, closing the lid does nothing (for now) .

Note 6:
busybox 1.18.3 acpid works with the -p option, 1.19.3 at racy seems not to like the -p option .
[EDIT]
So far as i can observe it, busybox acpid does not create files in /var :/var/log/acpid.log and /var/run/acpid.pid don't get created (bb 1.19.3)
[/EDIT]

Note 7:
Maybe the button module is not necessary, but the evdev.ko module .

Have fun !
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Sat 02 Jun 2012, 07:33    Post_subject:  

screenshot of GUIs :
_acpi_GUIs.jpg
 Description   
 Filesize   35.91 KB
 Viewed   2546 Time(s)

_acpi_GUIs.jpg

Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Thu 16 Aug 2012, 07:36    Post_subject: busybox acpid severe bug for input devices
Sub_title: busybox <=1.20.0
 

Short update and warning : Busybox acpid seems to have a bug that makes a function looping resulting in 100% CPU usage of one Core .

: acpid hangs with full cpu usage when removing USB input devices

I can confirm this for busybox-1.18.3 acpid with the automatic deconnection of a bluetooth mouse to a usb bt-dongle when the mouse is too long idle.

Should be fixed in 1.20.x version .
Quote:
acpid: close fds which are reported as dead (POLLERR/POLLHUP/POLLNVAL) by poll

http://www.busybox.net/
Back to top
View user's profile Send_private_message Visit_website 
scabz


Joined: 30 Apr 2009
Posts: 317
Location: Tallahassee FL US

PostPosted: Mon 05 Aug 2013, 12:05    Post_subject:  

Precise 5.6.1 has BusyBox v1.21.0, power button and lid switch works but cant find any other keys presses.

the script i use for power button.

/etc/acpi/PWRF/00000080
Code:
#!/bin/sh
# Patriot Jan 2009 for Puppy Linux 4.1.1 GPL
# Revision 0.0.6
# 13sep09 dialogbox by shinobar
# 4nov09 TIMELIMIT 30sec
# 26dec09 wmpoweroff, adjustable less than 10sec.
# 12feb10 stop acpid before powroff

TIMELIMIT=30   # sec, no dialog if 0(zero).

_farewell="Power button is pushed, and about to shut down..."
_press_ok="Press 'OK' to shutdown right now,"
_or_cancel="'Cancel' to continue puppy."
#_ten_sec="Shutting down in 10 seconds."
_limit1="Shutting down in"
_limit2="seconds."

#echo $0 > /root/acpi.log
#date >> /root/acpi.log

SOUND="/usr/share/audio/bark.au"
PLAY="aplay"
[ -f "$SOUND" ] && which $(basename $PLAY) >/dev/null && $(basename $PLAY) "$SOUND"

#echo "DISPLAY=$DISPLAY" >> /root/acpi.log
X_pid=`ps ax | awk '{if (match($5, "X$") || $5 == "X") print $1}'`
if [ "$X_pid" != "" ]; then
#if [ "$DISPLAY" != "" ]; then
 [ -f /etc/rc.d/PUPSTATE ] && source /etc/rc.d/PUPSTATE
 [ -f /etc/rc.d/pupsave.conf ] && source /etc/rc.d/pupsave.conf
 GTKDIALOG=$(which gtkdialog3)
 PUPSAVECONFIG=$(which pupsaveconfig)
 [ "$PUPSAVECONFIG" = "" ] && PUPSAVECONFIG=$(which pupsave)
 [ "$TIMELIMIT" = "" ] && TIMELIMIT=0
 if [ $TIMELIMIT -gt 0 ] && [ "$GTKDIALOG" != "" ] && \
  [ "$PUPMODE" != "5" -o "$PRECHOICE" != "" -o "$PUPSAVECONFIG" = "" ]; then

   mo=acpi.mo
   # set locale
   for lng in C $(echo $LANGUAGE|cut -d':' -f1) $LC_ALL $LANG;do :;done   # ex.    ja_JP.UTF-8
   # search locale file
   lng1=$(echo $lng|cut -d'.' -f1)      # ex.   ja_JP
   lng2=$(echo $lng|cut -d'_' -f1)   # ex.   ja
   LOCALEDIR=/usr/share/locale
   [ "$mo" ] || mo=$(basename $0).mo
   for D in en C $lng2 $lng1 $lng
   do
     F="$LOCALEDIR/$D/LC_MESSAGES/$mo"
     [ -f "$F" ] && . "$F"
   done
   DIV=10
   [ $TIMELIMIT -le 20 ] && DIV=5
   [ $TIMELIMIT -le 10 ] && DIV=$TIMELIMIT
   STEP=$(($TIMELIMIT / $DIV))
   TIMELIMIT=$(($STEP * $DIV))
   PITCH=$((100 / $DIV))
   export DIALOG="<window title=\"acpid\"><vbox>
  <text><label>$_farewell</label></text>
  <text><label>$_press_ok</label></text>
  <text><label>$_or_cancel</label></text>
  <progressbar><label>$_limit1 $TIMELIMIT $_limit2</label>
      <input>for i in \$(seq 0 $PITCH 100); do echo \$i; sleep $STEP; done</input>
      <action type=\"exit\">OK</action>
  </progressbar>
  <hbox>
   <button cancel></button>
   <button ok></button>
  </hbox>
 </vbox></window>"
 #echo "$DIALOG"
   eval $($GTKDIALOG -p DIALOG -c)
   [ "$EXIT" = "Cancel" ] && exit
 fi
 P=wmpoweroff
else
 P=poweroff
fi
/etc/init.d/rc.acpi stop
exec $P


and lid switch

/etc/acpi/LID/00000080
Code:
#!/bin/sh
echo mem > /sys/power/state


I use xbindkeys for the keys that do not work with busybox acpid, thankfully fn keys work with xbindkeys.

My eeepc 1005hab needs this boot option for fn keys to work acpi_osi=Linux

My eeepc 900a does not need any boot options for fn keys to work.
Back to top
View user's profile Send_private_message AIM YIM 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Mon 05 Aug 2013, 14:54    Post_subject:  

Hi Scabz !

Right now have installed MacpupFoxy3 full to sda9 on a dmidecode
Quote:
Base Board Information
Manufacturer: ASUSTeK Computer INC.
Product Name: 1005HAG
Version: x.xx
Serial Number: EeePC-0123456789
Asset Tag: To Be Filled By O.E.M.
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: To Be Filled By O.E.M.
Chassis Handle: 0x0003
Type: Motherboard


running kernel uname -r 3.9.9-KRG-iCore2-smp-pae-srv1000gz
cat /proc/cmdline panic=56 loglevel=3 root=/dev/sda9 ro debug panic=20 vga=ask

Fn keys work as numpad replacement : 1-9 0, Pup/Pdn/Home/End +-*/ .

For the others I have to find out . I am guessing busybox uses its own syntax or acpid v1 syntax . For regular keys I think I would look into recent lighthouse or saluki to check out theirs /etc/acpi/keys file .
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Mon 05 Aug 2013, 15:04    Post_subject:  

BTW> just installed flashblock into FF-16 -- The add on top of the forum is much much much too heavy for flashplayer 11.2.202.x on 2x800MHz .
_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Fri 16 May 2014, 14:08    Post_subject: acpi.map file  

For this Asus EeePC 1005 i finally figured out how the /etc/acpi.map file should look like .

Hint was the
Code:
static const struct acpi_event f_evt_tab[] = {
   { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRF 00000080" },
   { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRB 00000080" },
   { "EV_SW", 0x05, "SW_LID", 0x00, 1, "button/lid LID0 00000080" },
};
code in busybox/util-linux/acpid.c source code .

The /etc/acpi.map file looks as
Code:
"EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRF 00000080"
"EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRB 00000080"
"EV_SW" 0x05 "SW_LID" 0 1 "button/lid LID 00000080"

and the /etc/acpid.conf file looks as
Code:
PWRF busybox/powerbutton
LID busybox/lidclose

busybox/lidclose and busybox/powerbutton are the former 0*80 scripts .
busybox/ is a directory inside /etc/acpi/ directory .
ls -1 /etc/acpi/busybox
lidclose
powerbutton
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Fri 16 May 2014, 17:56    Post_subject: Howto read /proc/acpi/event file  

Code:
while [ 1 = 1 ];
do
read EVENT </proc/acpi/event;
case "$EVENT" in
*LID*) echo "$0::GOT LID event:$EVENT";;
*PWR*) echo "$0::GOT PWR event:$EVENT";;
*) echo "$0::UNKNOWN event:$EVENT";;
esac;
sleep 1;
done


The only Fn keys additionally supported are

/bin/bash::UNKNOWN event:button/sleep SLPB 00000080 00000001

/bin/bash::UNKNOWN event:video LCDD 00000087 00000000
/bin/bash::UNKNOWN event:video LCDD 00000086 00000000


No touchpad en/disabling , no screen switch or any sound keys are leaving notes in
/proc/acpi/event file .

Linux is lumber found besides the street
Old or refuse household stuff; things cumbrous, or bulky
and useless, or of small value.
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Tue 20 May 2014, 08:35    Post_subject:  

Finally could enable all Fn keys with busybox acpid :

1)
Load the evbug kernel driver if enabled while kernel configuration
and run a key logging script :
Code:
#!/bin/sh

/sbin/modprobe -v evbug

while [ 1 = 1 ]
do

DMESG_TAIL1=`dmesg |tail -n1 | sed 's/\[/\\\[/;s/\]/\\\]/'`
test "$DMESG_TAIL1" = "$DMESG_TAIL1_OLD" && { sleep 0.5;continue; }
#echo "DMESG_TAIL1=$DMESG_TAIL1"

case "$DMESG_TAIL1" in
*input0*) KEYS=`dmesg | grep -B2 "$DMESG_TAIL1"`;;
*)        KEYS=`dmesg | grep -B1 "$DMESG_TAIL1"`;;
esac
echo "KEY PRESSED :
$KEYS
"
DMESG_TAIL1_OLD="$DMESG_TAIL1"

sleep 0.5

done

to find out the key code numbers when pressing Fn+MUTE for example and Control+C terminate the script afterwards .

The key numbers should be defined in
/usr/include/linux/input.h
file in the devx
like :
Code:
#define EV_SYN         0x00
#define EV_KEY         0x01
#define EV_REL         0x02
#define EV_ABS         0x03
#define EV_MSC         0x04
#define EV_SW         0x05

#define KEY_MUTE      113
#define KEY_VOLUMEDOWN      114
#define KEY_VOLUMEUP      115
#define KEY_POWER      116   /* SC System Power Down */


So my /etc/acpi.map looks as
Code:
"EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRF 00000080"
"EV_KEY" 0x01 "KEY_POWER" 116 1 "button/power PWRB 00000080"
"EV_KEY" 0x01 "KEY_SLEEP" 142 1 "button/sleep SLPB 00000080"
"EV_KEY" 0x01 "KEY_SWITCHVIDEOMODE" 227 1 "SVM"
"EV_KEY" 0x01 "KEY_BRIGHTNESS_ZERO" 244 1 "BRIGHT0"
"EV_KEY" 0x01 "KEY_DISPLAY_OFF" 245 1 "DOFF"
"EV_KEY" 0x01 "KEY_MUTE" 113 1 "MUTE"
"EV_KEY" 0x01 "KEY_VOLUMEDOWN" 114 1 "VOLD"
"EV_KEY" 0x01 "KEY_VOLUMEUP" 115 1 "VOLU"
"EV_KEY" 0x01 "KEY_WLAN" 238 1 "WLAN"
"EV_KEY" 0x01 "KEY_PROG1" 148 1 "PROG1"

#"EV_KEY" 0x01 "TP_TOGGLE" 530 1 "button/touchpad TPTB 00000080"
"EV_KEY" 0x01 "KEY_TOUCHPAD_TOGGLE" 530 1 "TPTOGGLE"
"EV_KEY" 0x01 "KEY_TOUCHPAD_ON"     531 1 "TPON"
"EV_KEY" 0x01 "KEY_TOUCHPAD_OFF"    532 1 "TPOFF"

"EV_SW" 0x05 "SW_LID" 0 1 "button/lid LID 00000080"

where the last entry in each line is an identifier for the /etc/acpid.conf file :
Code:
PWRF busybox/powerbutton
LID busybox/lidclose
SLPB busybox/lidclose
TPTOGGLE busybox/toggletouchpad
MUTE busybox/mute
VOLD  busybox/sound_down
VOLU  busybox/sound_up
PROG1 busybox/taskmanager
BRIGHT0 busybox/screenlock
WLAN  busybox/connect
SVM   busybox/switch_monitor

And the /etc/acpi/busybox/mute script is as :
Code:
#!/bin/ash

/bin/logger -t "acpid:$0" -p 1 "Started"

MUTE_STATUS=`amixer get Master | tail -n1`

case "$MUTE_STATUS"
in
*\[on\]*)  amixer set Master mute || /bin/logger -t "acpid:$0" -p 1 "Failed to mute";;
*\[off\]*) amixer set Master unmute || /bin/logger -t "acpid:$0" -p 1 "Failed to unmute";;
*) /bin/logger -t "acpid:$0" -p 1 "UNKNOWN MUTE_STATUS='$MUTE_STATUS'";;
esac

/bin/logger -t "acpid:$0" -p 1 "Ended"

for example .

Since every notebook, laptop or multimedia-keyboard has their own special keys ,
everyone needs to figure the correct code numbers on his own .
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1282s ][ Queries: 13 (0.0050s) ][ GZIP on ]