View previous topic :: View next topic |
Author |
Message |
fernandotcl Veteran
Joined: 20 Nov 2003 Posts: 1396 Location: Sao Paulo, Brazil
|
Posted: Fri Aug 06, 2004 1:19 am Post subject: HOW-TO - Botão de força com ACPI |
|
|
Para usar ACPI, é necessário compilar o kernel com suporte à ACPI e às seções desejadas:
Code: | Power management options (ACPI, APM) --->
[*] Power Management support
ACPI (Advanced Configuration and Power Interface) Support --->
[*] ACPI Support
<*/M> Button |
Depois devemos instalar o acpid:
E então editar o arquivo "/etc/acpi/default.sh":
Code: | #!/bin/sh
# Default acpi script that takes an entry for all actions
set $*
group=${1/\/*/}
action=${1/*\//}
case "$group" in
button)
case "$action" in
power)
xstatus=`pgrep xinit`
if [ ! -z $xstatus ] ; then
button=`gtkshutdown`
case "$button" in
0) ;;
1) halt
;;
2) reboot
;;
*) logger "Ocorreu um erro enquanto GtkShutdown era executado."
;;
esac
fi
;;
*) logger "ACPI action $action is not defined"
;;
esac
;;
*) logger "ACPI group $group / action $action is not defined"
;;
esac
|
No exemplo acima, o programa GtkShutDown foi utilizado para apresentar uma mensagem perguntando ao usuário como proceder. No entanto, qualquer ação pode ser tomada para reagir com o evento do pressionamento do botão de força.
Agora basta ajustar o acpid para iniciar com a máquina e iniciar o serviço para testar:
Code: | rc-update add acpid default
/etc/init.d/acpid start |
NOTAS:
- Eu experienciei problemas com o acpid. De vez em quando tive que reiniciar o serviço para que voltasse a funcionar.
- O GtkShutDown está procurando algum mantenedor, já que eu não uso mais o acpid e então não estou mais atualizando o projeto.
---
Sugestões e alterações são bem vindas. |
|
Back to top |
|
|
Kobal Guru
Joined: 12 Feb 2004 Posts: 323 Location: Brasil / Brazil / Brésil / Brasilien / el Brasil
|
Posted: Fri Aug 06, 2004 4:54 am Post subject: |
|
|
falo nada, eu sempre compilo acpi, então ele não servia pra nada. |
|
Back to top |
|
|
Mythos l33t
Joined: 02 May 2004 Posts: 953 Location: Portugal
|
Posted: Fri Aug 06, 2004 1:27 pm Post subject: |
|
|
Code: | #/etc/acpi/events/default:
# This is the ACPID default configuration, it takes all
# events and passes them to /etc/acpi/default.sh for further
# processing.
# event keeps a regular expression matching the event. To get
# power events only, just use something like "event=button power.*"
# to catch it.
# action keeps the command to be executed after an event occurs
# In case of the power event above, your entry may look this way:
event=button power.*
action=/sbin/init 0
# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.
event=.*
action=/etc/acpi/default.sh %e |
Para carregar no power e o PC se desligar uso isto. _________________ Best Regards,
Sérgio Henrique
Linux dune 3.0.6-gentoo #1 SMP Thu Oct 27 16:47:29 WEST 2011 x86_64 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|