View previous topic :: View next topic |
Author |
Message |
nagaraju.karre n00b
Joined: 04 Apr 2012 Posts: 1
|
Posted: Wed Apr 04, 2012 1:10 pm Post subject: power button press event |
|
|
Hi ,
my kernel is provided witk apm emulation support.
My requirement is know the power button press evnt or status information.I am unable to find this status.in this gnome power manager is running.
When i press the power button it is coming with the popup message shutdown,susupend,retsrt asking.
Please suggest me from where they are getting the power button press event.
where should i look for this.
any user space command i need to run to get the power button press event.
Thanks,
----- |
|
Back to top |
|
|
tomtom69 Apprentice
Joined: 09 Nov 2010 Posts: 255 Location: Bavaria
|
Posted: Thu Apr 05, 2012 6:13 pm Post subject: |
|
|
Hi,
if you are using ACPI, there should be a script named /etc/acpi/default.sh which handles ACPI events, including power button.
I am using this to hibernate-ram when pressing the power switch, so my /etc/acpi/default.sh looks like this:
-------------
#!/bin/sh
# /etc/acpi/default.sh
# Default acpi script that takes an entry for all actions
set $*
group=${1%%/*}
action=${1#*/}
device=$2
id=$3
value=$4
log_unhandled() {
logger "ACPI event unhandled: $*"
}
case "$group" in
button)
case "$action" in
power)
/usr/sbin/hibernate-ram
;;
# if your laptop doesnt turn on/off the display via hardware
# switch and instead just generates an acpi event, you can force
# X to turn off the display via dpms. note you will have to run
# 'xhost +local:0' so root can access the X DISPLAY.
#lid)
# xset dpms force off
# ;;
*) log_unhandled $* ;;
esac
;;
ac_adapter)
case "$value" in
# Add code here to handle when the system is unplugged
# (maybe change cpu scaling to powersave mode). For
# multicore systems, make sure you set powersave mode
# for each core!
#*0)
# cpufreq-set -g powersave
# ;;
# Add code here to handle when the system is plugged in
# (maybe change cpu scaling to performance mode). For
# multicore systems, make sure you set performance mode
# for each core!
#*1)
# cpufreq-set -g performance
# ;;
*) log_unhandled $* ;;
esac
;;
*) log_unhandled $* ;;
esac
------------
tom |
|
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
|
|