Skip to contentSkip to conversation

lid state?

DISCUSSION John Belmonte 5 participants 5 messages Oct 6, 2002 – Oct 7, 2002 2 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

Hello,

What is the correct way to detect the lid state on a lid event? I've seen some mention of using a counter, but as the lid could be closed before acpid starts up, it doesn't seem very robust.

-John

Signature · 8 lines
http:// i      .   /



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#1 lore raw

From: "John Belmonte" <[email protected]>

Quoted 4 lines

What is the correct way to detect the lid state on a lid event? I've seen some mention of using a counter, but as the lid could be closed before acpid starts up, it doesn't seem very robust.

It's far from ideal, but it's robust enough, because the lid state bears no connection to acpid. Whether or not acpid is running, events get generated. I suppose, conceivably, the lid could be closed when the system boots and ACPI starts - but how realistic is that? I can't see it happening on my system.
--
derek

-------------------------------------------------------
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): OE13CngokVNTmgEVg3U0000c5a1-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org

#3 lore raw
Quoted 5 lines · Derek Broughton

It's far from ideal, but it's robust enough, because the lid state bears no connection to acpid. Whether or not acpid is running, events get generated. I suppose, conceivably, the lid could be closed when the system boots and ACPI starts - but how realistic is that? I can't see it happening on my system.

It's very well possible to do that. And it breaks any on/off type script you set up for the lid button.

I'd like separate open and close messages as well actually..

Martijn

Signature · 8 lines
You may be infinitely smaller than some things, but you're infinitely 
larger than others.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Derek Broughton

From: "John Belmonte" <[email protected]>

Quoted 3 lines

What is the correct way to detect the lid state on a lid event? I've seen some mention of using a counter, but as the lid could be closed before acpid starts up, it doesn't seem very robust.

It's far from ideal, but it's robust enough, because the lid state bears no connection to acpid. Whether or not acpid is running, events get generated. I suppose, conceivably, the lid could be closed when the system boots and ACPI starts - but how realistic is that? I can't see it happening on my system.

Very realistic if you have attached an external monitor to your notebook.

Frank

Signature · 9 lines
Frank Mehnert
## Dept. of Computer Science, Dresden University of Technology, Germany ##
## E-Mail: fm3-IG//[email protected]    http://os.inf.tu-dresden.de/~fm3 ##


-------------------------------------------------------
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): E17yYmP-0004wp-00-Hkr6DilkjYZTIIw02KIYYwp9XTrnmqkB@public.gmane.org

#6 lore raw
Quoted 7 lines · Frank Mehnert
Quoted 6 lines · Derek Broughton

From: "John Belmonte" <[email protected]>

Quoted 3 lines

What is the correct way to detect the lid state on a lid event? I've seen some mention of using a counter, but as the lid could be closed before acpid starts up, it doesn't seem very robust.

Quoted 8 lines
Quoted 5 lines

It's far from ideal, but it's robust enough, because the lid state bears no connection to acpid. Whether or not acpid is running, events get generated. I suppose, conceivably, the lid could be closed when the system boots and ACPI starts - but how realistic is that? I can't see it happening on my system.

Very realistic if you have attached an external monitor to your notebook.

This would be nice, but as a workaround/solution, I use touch in my lid.sh script. Eg:

#!/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
                else
                        logger -p daemon.info "ACPI lid: lid is closed"
                        touch $CLOSEDFILE
                fi
                ;;                      
            *)
                logger -p daemon.info "ACPI lid: unknown event $3 (in
$@)"
                ;;
        esac
        ;;
    *)
        logger -p daemon.info "ACPI lid: unknown event $2 (in $@)"
        ;;

esac

Since (on my system) /var/run is cleaned out on boot, this works fine. Of course, if the lid is closed when the machine comes on, this is backwards, but I can't turn my laptop on when the lid is closed, so no big deal for me. The script could also check if an external monitor was connected, etc to make sure that it works in whatever situation.

Jamie Strandboge

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf