Re: [gentoo-user] Power butten

2006-09-16 Thread Mick
On Saturday 16 September 2006 00:53, Richard Fish wrote:

 You need to add a sleep case here to do whatever you want to happen
 when you press the pwer button...

Thanks Richard,

I have added this:
===
case $group in
button)
case $action in
power)
/sbin/init 0
;;
sleep)
/usr/sbin/hibernate
;;

# 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
;;

===

and it now hibernates nicely.  I have another acpi event question, but I'll 
start a new thread for it since it is not relevant.

I hope my question and answers I received have satisfied the OP requirements 
too.
-- 
Regards,
Mick


pgpsstYEtAw8I.pgp
Description: PGP signature


Re: The Big Red Button - was Re: [gentoo-user] Power butten

2006-09-16 Thread William Kenworthy
use a usb mouse - dismantle it and use your big red button to close the
left mouse switch (or better one of the aux ones if they exist).  Map
this to shutdown the system.

BillK

On Sat, 2006-09-16 at 11:17 +1000, Andrew Lowe wrote:
 Ryan Tandy wrote:
  rob wrote:
  How do you get power pitten to shutdown and power off Gentoo box

 
 Just a slight hijacking of this topic,
   I have a little EPIA server acting as firewall, npt, dhcp, dns,etc,etc. 
 Now even though it doesn't pull a lot of power, I don't want it running 

-- 
gentoo-user@gentoo.org mailing list



Re: The Big Red Button - was Re: [gentoo-user] Power butten

2006-09-16 Thread Iain Buchanan
On Sat, 2006-09-16 at 11:17 +1000, Andrew Lowe wrote:
 
 Just a slight hijacking of this topic,
   I have a little EPIA server acting as firewall, npt, dhcp, dns,etc,etc. 
 Now even though it doesn't pull a lot of power, I don't want it running 
 all the time, it has something to do with missing ice caps. So I want to 
 build a button that attaches to the machine via, say, usb that when 
 pushed shuts the machine down. By a button I mean that sort of emergency 
 shutdown button that is usually red and used in industrial control, the 
 sort of thing the hero always has to push to save the heroine/world.

don't know about the James Bond stuff - you'd probably also need an lcd
countdown where the button only works if you press it on 007...

anyway, you probably don't want to go exactly the way of the industrial
Emergency Stop, as it's a hardware cutoff - ie. power is shut of
straight away, without any software intervention.  Your disks will
probably survive the unclean unmounts, and you power supply may handle
the voltage / frequency spikes from the switch opening, but why bother?

If you really want, you can pick them up from any electrical distributer
(in Australia anyway)...

   Does anyone here have enough hardware design knowledge to say if this 
 would be easy or not and as to whether I should just lower my sights and 
 stick to the three finger salute or the normal on/off switch?

If I were you, I'd want to stay with the ACPI power button, most popular
OS's can detect this nicely.  What you can do is this:

- splice the power switch cable (the motherboard/case one, NOT the
power supply side!).  The button works by completing a circuit to the
motherboard when pressed, so you can have two buttons doing the same
thing on the same circuit.  Join a new wire of each of the two existing
wires. (Inside your case, they're usually labelled PWRSW or something).
- buy any sort of big red button (normally open, non latching) and wire
it to the two new wires.  I have a nice arcade fire button which would
do the trick.
- stick it on the top / front of your case with a sign saying PRESS
ME (or maybe don't touch if you want to go for the reverse psychology
angle...)

voila!

 p.s. The main reason driving this is that the wife never turns the 
 server off. If I have a Big Red Switch, I can say But it has a big red 
 switch, how can you miss it

you could try some reNedufication, or perhaps a script that detects
how many users are logged in and for how long, and then shutdown
automatically.  Or just shutdown at midnight (or whatever time she's
guaranteed not to be on...
-- 
Iain Buchanan iaindb at netspace dot net dot au

fortune: cannot execute.  Out of cookies.

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-15 Thread Mick
Don't mean to hijack this thread, but my situation is probably similar to the 
OP.

On Friday 15 September 2006 02:57, Daniel Iliev wrote:
 Iain Buchanan wrote:

  Finally, if it still doesn't work, post what you see from
  tail -f /var/log/messages
  or whatever your syslog is, when you press the power button.

ACPI event unhandled: button/sleep C1A3 0080 0001

 You have to activate button under ACPI in the kernel:

I have this activated, but nothing happens other than the unhandled event 
error above.

 After emergeing acpid and runing it, you should have shutdown now
 mapped to your power button.

I would rather have hibernate mapped to it.  How?

PS. I think that sleep (save to RAM) does not work on this laptop, not when X 
is running anyway.
-- 
Regards,
Mick


pgpoBmqJf3LBw.pgp
Description: PGP signature


Re: [gentoo-user] Power butten

2006-09-15 Thread Bo Ørsted Andresen
On Friday 15 September 2006 12:47, Mick wrote:
 Don't mean to hijack this thread, but my situation is probably similar to
 the OP.

 On Friday 15 September 2006 02:57, Daniel Iliev wrote:
  Iain Buchanan wrote:
   Finally, if it still doesn't work, post what you see from
   tail -f /var/log/messages
   or whatever your syslog is, when you press the power button.

 ACPI event unhandled: button/sleep C1A3 0080 0001

  You have to activate button under ACPI in the kernel:

 I have this activated, but nothing happens other than the unhandled event
 error above.

  After emergeing acpid and runing it, you should have shutdown now
  mapped to your power button.

 I would rather have hibernate mapped to it.  How?

 PS. I think that sleep (save to RAM) does not work on this laptop, not when
 X is running anyway.

Perhaps [1] will give you a clue. Otherwise feel free to ask again.

[1] 
http://gentoo-wiki.com/HOWTO_Shutdown_headless_server_when_power-button_pressed

-- 
Bo Andresen


pgpN5eFaMpprp.pgp
Description: PGP signature


Re: [gentoo-user] Power butten

2006-09-15 Thread Mick
On Friday 15 September 2006 11:58, Bo Ørsted Andresen wrote:

 Perhaps [1] will give you a clue. Otherwise feel free to ask again.

 [1]
 http://gentoo-wiki.com/HOWTO_Shutdown_headless_server_when_power-button_pre
ssed

Thanks!  I hadn't spotted this article.  I've tried adding the following two 
lines in /etc/acpid/event/default but nothing much happened (as per the log 
further down):

event=button[ /]power.*
action=/usr/sbin/hibernate-ram

This is the log:

== /var/log/acpid ==
[Fri Sep 15 19:59:26 2006] received event button/sleep C1A3 0080 
0006
[Fri Sep 15 19:59:26 2006] executing action /etc/acpi/default.sh button/sleep 
C1A3 0080 0006
[Fri Sep 15 19:59:26 2006] BEGIN HANDLER MESSAGES
[Fri Sep 15 19:59:26 2006] END HANDLER MESSAGES
[Fri Sep 15 19:59:26 2006] action exited with status 0
[Fri Sep 15 19:59:26 2006] completed event button/sleep C1A3 0080 
0006

== /var/log/messages ==
Sep 15 19:59:26 lappy logger: ACPI event unhandled: button/sleep C1A3 0080 
0006
Sep 15 19:59:26 lappy logger: ACPI event unhandled: button/sleep C1A3 0080 
0006


It's as if the two lines I've added were ignored.

This is what dmesg shows about C1A3:

# dmesg | grep -i C1A3
ACPI: Sleep Button (CM) [C1A3]
C052 C17E C185 C0A4 C0AA C19F C1A0 C1A3 C1A4


What now?
-- 
Regards,
Mick


pgpePFOKZf28v.pgp
Description: PGP signature


Re: [gentoo-user] Power butten

2006-09-15 Thread Nico Schümann

2006/9/15, Mick [EMAIL PROTECTED]:

On Friday 15 September 2006 11:58, Bo Ørsted Andresen wrote:
Thanks!  I hadn't spotted this article.  I've tried adding the following two
lines in /etc/acpid/event/default but nothing much happened (as per the log
further down):

event=button[ /]power.*
action=/usr/sbin/hibernate-ram


Well, my configuration slightly differs from your one.
--- /etc/acpid/events/default

event=.*
action=/etc/acpi/default.sh %e


--- /etc/acpid/default.sh

set $*

group=${1/\/*/}
action=${1/*\//}

case $group in
   button)
   case $action in
   power)  echo disk  /sys/power/state
   ;;
   sleep)  echo disk  /sys/power/state
   ;;
   *)  logger ACPI action $action is not defined
   ;;
   esac
   ;;

   *)
   logger ACPI group $group / action $action is not defined
   ;;
esac


button/power and button/sleep are _not_ the same and as the log tells
us, it's a button/sleep event. If I get this right, in your
configuration, only a button/power is handeled.

Regards,
Nico

--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-15 Thread Mick
On Friday 15 September 2006 21:18, Nico Schümann wrote:

 Well, my configuration slightly differs from your one.
 --- /etc/acpid/events/default

 event=.*
 action=/etc/acpi/default.sh %e

No it doesn't really.  The default entries in mine were as you show above.  I 
just followed the comments in the file to separately define what should 
happen when the power button is pressed, but it didn't work anyway.


 --- /etc/acpid/default.sh

 set $*
 
 group=${1/\/*/}
 action=${1/*\//}
 
 case $group in
 button)
 case $action in
 power)  echo disk  /sys/power/state
 ;;
 sleep)  echo disk  /sys/power/state
 ;;
 *)  logger ACPI action $action is not
  defined ;;
 esac
 ;;
 
 *)
 logger ACPI group $group / action $action is not defined
 ;;
 esac

 button/power and button/sleep are _not_ the same and as the log tells
 us, it's a button/sleep event. If I get this right, in your
 configuration, only a button/power is handeled.

What/who determines what goes in /etc/acpid/default.sh?  This is what's in 
mine:
===
#!/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)
/sbin/init 0
;;
# 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)
#*0)
#   ;;

# Add code here to handle when the system is plugged 
in
# (maybe change cpu scaling to performance mode)
#*1)
#   ;;

*)  log_unhandled $* ;;
esac
;;

*)  log_unhandled $* ;;
esac
===

I don't really understand what this script is telling me.  :-(
-- 
Regards,
Mick


pgp5rEZMT2QzV.pgp
Description: PGP signature


Re: [gentoo-user] Power butten

2006-09-15 Thread Richard Fish

On 9/15/06, Mick [EMAIL PROTECTED] wrote:

case $group in
button)
case $action in
power)
/sbin/init 0
;;


You need to add a sleep case here to do whatever you want to happen
when you press the pwer button...


*)  log_unhandled $* ;;


...or this case is executed.  The log_unhandled function generates a
message in the form of:

ACPI event unhandled: button/foo

Sound familiar? ;-)

So if you want power to shutdown nicely, try adding:

   sleep)
   /sbin/init 0

-Richard
--
gentoo-user@gentoo.org mailing list



The Big Red Button - was Re: [gentoo-user] Power butten

2006-09-15 Thread Andrew Lowe

Ryan Tandy wrote:

rob wrote:

How do you get power pitten to shutdown and power off Gentoo box

rob


# emerge sys-power/acpid
# rc-update add acpid default
# /etc/init.d/acpid start

and you're done!  The default configuration for acpid includes a handler 
for the power button event.


HTH.


Just a slight hijacking of this topic,
	I have a little EPIA server acting as firewall, npt, dhcp, dns,etc,etc. 
Now even though it doesn't pull a lot of power, I don't want it running 
all the time, it has something to do with missing ice caps. So I want to 
build a button that attaches to the machine via, say, usb that when 
pushed shuts the machine down. By a button I mean that sort of emergency 
shutdown button that is usually red and used in industrial control, the 
sort of thing the hero always has to push to save the heroine/world.


	Does anyone here have enough hardware design knowledge to say if this 
would be easy or not and as to whether I should just lower my sights and 
stick to the three finger salute or the normal on/off switch?


Regards,
Andrew

p.s. The main reason driving this is that the wife never turns the 
server off. If I have a Big Red Switch, I can say But it has a big red 
switch, how can you miss it


--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-14 Thread George Prowse

Press and hold in for 3-5 seconds, that is a hard shutdown if it wont turn off

George

On 14/09/06, rob [EMAIL PROTECTED] wrote:

How do you get power pitten to shutdown and power off Gentoo box

rob
--
gentoo-user@gentoo.org mailing list



--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-14 Thread Iain Buchanan
On Thu, 2006-09-14 at 18:17 -0400, rob wrote:
 How do you get power pitten to shutdown and power off Gentoo box

What happens now when you press the power button?  What does your syslog
say?

First of all, you need an ATX motherboard.  (Any motherboard newer than
about 7/8 or so years ago).  Then you need ACPI compiled into your
kernel, as well as `emerge acpid`.

Finally, if it still doesn't work, post what you see from
tail -f /var/log/messages
or whatever your syslog is, when you press the power button.

post back if that doesn't work!
-- 
Iain Buchanan iaindb at netspace dot net dot au

If you fail to plan, plan to fail.

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-14 Thread Ryan Tandy

rob wrote:

How do you get power pitten to shutdown and power off Gentoo box

rob


# emerge sys-power/acpid
# rc-update add acpid default
# /etc/init.d/acpid start

and you're done!  The default configuration for acpid includes a handler 
for the power button event.


HTH.
--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Power butten

2006-09-14 Thread Daniel Iliev
Iain Buchanan wrote:
 On Thu, 2006-09-14 at 18:17 -0400, rob wrote:
   
 How do you get power pitten to shutdown and power off Gentoo box
 

 What happens now when you press the power button?  What does your syslog
 say?

 First of all, you need an ATX motherboard.  (Any motherboard newer than
 about 7/8 or so years ago).  Then you need ACPI compiled into your
 kernel, as well as `emerge acpid`.

 Finally, if it still doesn't work, post what you see from
 tail -f /var/log/messages
 or whatever your syslog is, when you press the power button.

 post back if that doesn't work!
   
Only a small addition to Mr. Iain Buchanan's reply.

You have to activate button under ACPI in the kernel:

cd /usr/src/linux  make menuconfig
 - Power management options (ACPI, APM) -
 ACPI (Advanced Configuration and Power Interface) Support
   - Button *  here say YES

After emergeing acpid and runing it, you should have shutdown now
mapped to your power button.

-- 
Best regards,
Daniel


-- 
gentoo-user@gentoo.org mailing list