[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [despammed] Sleep acpi - comando per spegnere il monitor



ciao Riccardo Gusso,

> Un'ultima domanda: secondo te e` possibile far si che lo script venga
> avviato automaticamente quando si chiude il laptop?

devi configurare acpid

esempio:

--------------------------------------------------
# cat /etc/acpi/events/lid 
# /etc/acpid/events/lids
# This is called when the user close the monitor
# /etc/acpid/lids.sh for further processing.

# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.

# We need to react on "button power.*" and "button/power.*" because
# of kernel changes.

event=button[ /]lid
action=/etc/acpi/lid.sh %e
--------------------------------------------------


--------------------------------------------------
# cat /etc/acpi/lid.sh 
#!/bin/sh
# /etc/acpi/lid.sh

EVENT=$1
TYPE=$2
ID1=$3
COUNTER=$4
STATUSFILE=/tmp/lid.status

echo "`date`<$@> - $EVENT - $TYPE - $ID1 - $COUNTER - " >> /tmp/acpid.log

STATUS=`cat /proc/acpi/button/lid/LID/state`

case $STATUS in
	*open)   play /home/paolop/audio/paolo_bentornato.wav & ;;
	*closed)	play /home/paolop/audio/paolo_buongiorno.wav & ;;
	*)       play /home/paolop/audio/wav/gong.wav & ;;
esac
--------------------------------------------------



oppure:

--------------------------------------------------
# cat /ec/acpi/events/hotkey 
# /etc/acpid/events/hotkey
# This is called when the user close the monitor
# /etc/acpid/hotkey.sh for further processing.

# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.

event=hotkey HOTK
action=/etc/acpi/hotkey.sh %e
--------------------------------------------------


--------------------------------------------------
# cat /etc/acpi/hotkey.sh 
#!/bin/sh
# /etc/acpi/hotkey.sh

EVENT=$1
TYPE=$2
ID1=$3
COUNTER=$4
STATUSFILE=/tmp/lid.status

echo "`date` - $EVENT - $TYPE - $ID1 - $COUNTER - " >> /tmp/acpid.log

case $ID1 in
	*50)	# 1 bottone
		play /home/paolop/audio/paolo_bentornato.wav & ;;
	*51)	# 2 bottone
		play /home/paolop/audio/paolo_buongiorno.wav & ;;
	*52)	# 3 bottone
		play /home/paolop/audio/wav/phone.wav & ;;
	*53)	# 4 bottone 
         # cambia canzone
		fuser -s -k2 /dev/dsp	;;
	*)		# tutto il resto
		play /home/paolop/audio/wav/pinguin.wav & 
		echo "$ID" >> /tmp/acpid.err ;;
esac
--------------------------------------------------


ciao


-- 
/* Paolo Pedaletti,



Reply to: