Determining Button State
Hello,
Looking at rolling out some sort of ACPI script environment for acpid. Is there any way that the ACPI system determines exposes what state the subsystem is in.
When I close the lid on my laptop, I get the event -
button/lid LID 00000080 0000000b
button/lid LID 00000080 0000000c
button/lid LID 00000080 0000000d
button/lid LID 00000080 0000000e
button/lid LID 00000080 0000000f
Which doesn't seem to have anything that indicates 'down or up'. I understand an 'up/down' doesn't make sense for Power or Sleep, but it seems pretty vital to something like a lid.
Regards,
Matthew
Signature · 10 lines
Matthew Tippett - [email protected] - (416) 435-4118 Technology Forum - http://www.technology-forum.org/ Commercial Open Source - http://www.commercialos.org/ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Matthew Tippett
Hello,
Looking at rolling out some sort of ACPI script environment for acpid. Is there any way that the ACPI system determines exposes what state the subsystem is in.
When I close the lid on my laptop, I get the event -
button/lid LID 00000080
0000000b
button/lid LID 000000800000000c
button/lid LID 000000800000000d
button/lid LID 000000800000000e
button/lid LID 000000800000000f
Quoted 3 lines
Which doesn't seem to have anything that indicates 'down or up'. I understand an 'up/down' doesn't make sense for Power or Sleep, but it seems pretty vital to something like a lid.
Nope, and you can't use odd or even either because it changes. I did this:
#!/bin/sh
CLOSEDFILE="/var/run/acpi_lid_closed"
case "$2" in
LID)
case "$3" in
00000080)
if [ -e "$CLOSEDFILE" ];
then
logger -p daemon.info "ACPI lid: lid is open"
rm -f $CLOSEDFILE
# go to X now
/usr/bin/chvt 7
# restore the keyboard
/sbin/kbdrate -r 30 -d 250 < /dev/console
else
logger -p daemon.info "ACPI lid: lid is closed"
touch $CLOSEDFILE
# go to a tty1 first
/usr/bin/chvt 1
fi
;;
*)
logger -p daemon.info "ACPI lid: unknown event $3 (in
$@)"
;;
esac
;;
*)
logger -p daemon.info "ACPI lid: unknown event $2 (in $@)"
;;esac
This however assumes that the lid is open when I power on (not an unreasonable assumption usually, since I can't press the power button otherwise). I chose /var/run since it is cleaned out automatically.
Jamie Strandboge
Signature · 11 lines
Email: [email protected] GPG/PGP ID: 26384A3A Fingerprint: D9FF DF4A 2D46 A353 A289 E8F5 AA75 DCBE 2638 4A3A ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
A message that is not in the archive (sent off-list or not yet received): 1039324752.3240.6.camel-Ty44UuN9vPJ5T2F9fCU5s856D9/[email protected]
Quoted 11 lines · James D Strandboge
Quoted 6 lines · Matthew Tippett
Hello,
Looking at rolling out some sort of ACPI script environment for acpid. Is there any way that the ACPI system determines exposes what state the subsystem is in.
# go to X now /usr/bin/chvt 7
Quoted 9 lines
# restore the keyboard /sbin/kbdrate -r 30 -d 250 < /dev/console else logger -p daemon.info "ACPI lid: lid is closed" touch $CLOSEDFILE# go to a tty1 first /usr/bin/chvt 1
Though its probably obvious, but all the chvt stuff is for my laptop and is assuming you are in X first-- which is an ok assumption for me. Closing the lid at a console with my script above won't work right.
Jamie
Signature · 11 lines
Email: [email protected] GPG/PGP ID: 26384A3A Fingerprint: D9FF DF4A 2D46 A353 A289 E8F5 AA75 DCBE 2638 4A3A ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
Hi!
Quoted 18 lines
Quoted 12 lines
Looking at rolling out some sort of ACPI script environment for acpid. Is there any way that the ACPI system determines exposes what state the subsystem is in.
When I close the lid on my laptop, I get the event -
button/lid LID 00000080
0000000b
button/lid LID 000000800000000c
button/lid LID 000000800000000d
button/lid LID 000000800000000e
button/lid LID 000000800000000fQuoted 3 lines
Which doesn't seem to have anything that indicates 'down or up'. I understand an 'up/down' doesn't make sense for Power or Sleep, but it seems pretty vital to something like a lid.
Nope, and you can't use odd or even either because it changes. I did this:
...
Quoted 3 lines
This however assumes that the lid is open when I power on (not an unreasonable assumption usually, since I can't press the power button otherwise). I chose
/var/runsince it is cleaned out automatically.
Fortunately at least toshibas and thinkpads have power btn available with lid closed -- it is pretty bad to have to open the lid to turn the machine on -- especially with external keyboard and monitor. Toshiba has LEDs visible from the outside for added bonus.
Pavel
Signature · 10 lines
Pavel Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need... ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 25 lines · Pavel Machek
Hi!
Quoted 18 lines
Quoted 12 lines
Looking at rolling out some sort of ACPI script environment for acpid. Is there any way that the ACPI system determines exposes what state the subsystem is in.
When I close the lid on my laptop, I get the event -
button/lid LID 00000080
0000000b
button/lid LID 000000800000000c
button/lid LID 000000800000000d
button/lid LID 000000800000000e
button/lid LID 000000800000000fQuoted 3 lines
Which doesn't seem to have anything that indicates 'down or up'. I understand an 'up/down' doesn't make sense for Power or Sleep, but it seems pretty vital to something like a lid.
Nope, and you can't use odd or even either because it changes. I did this:
...
Quoted 3 lines
This however assumes that the lid is open when I power on (not an unreasonable assumption usually, since I can't press the power button otherwise). I chose
/var/runsince it is cleaned out automatically.
Quoted 6 lines
Fortunately at least toshibas and thinkpads have power btn available with lid closed -- it is pretty bad to have to open the lid to turn the machine on -- especially with external keyboard and monitor. Toshiba has LEDs visible from the outside for added bonus.
That's cool. Is there anyway to poll the status of those led's from linux (eg through acpi)? An even better way would be to ask the bios the state of the lid when an event is generated-- or better still modify the acpi code to generate 0 for closed and 1 for open (or just be consistent about even and odd).
Jamie
Signature · 12 lines
Email: [email protected] GPG/PGP ID: 26384A3A Fingerprint: D9FF DF4A 2D46 A353 A289 E8F5 AA75 DCBE 2638 4A3A ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/