public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Determining Button State
@ 2002-12-08  5:01 Matthew Tippett
       [not found] ` <3DF2D221.7020005-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Tippett @ 2002-12-08  5:01 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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
-- 
Matthew Tippett - matthew.tippett-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org - (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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Determining Button State
       [not found] ` <3DF2D221.7020005-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org>
@ 2002-12-08  5:19   ` James D Strandboge
       [not found]     ` <1039324752.3240.6.camel-Ty44UuN9vPJ5T2F9fCU5s856D9/Od9gv@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: James D Strandboge @ 2002-12-08  5:19 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sun, 2002-12-08 at 00:01, Matthew Tippett wrote:
> 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.

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

-- 
Email:        jstrand1-aYIB8uWIUb2Vn7q6wjsIow@public.gmane.org
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Determining Button State
       [not found]     ` <1039324752.3240.6.camel-Ty44UuN9vPJ5T2F9fCU5s856D9/Od9gv@public.gmane.org>
@ 2002-12-08  5:31       ` James D Strandboge
  2002-12-10 13:31       ` Pavel Machek
  1 sibling, 0 replies; 6+ messages in thread
From: James D Strandboge @ 2002-12-08  5:31 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sun, 2002-12-08 at 00:19, James D Strandboge wrote:
> On Sun, 2002-12-08 at 00:01, Matthew Tippett wrote:
> > 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         
>          
>                         # 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

-- 
Email:        jstrand1-aYIB8uWIUb2Vn7q6wjsIow@public.gmane.org
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Determining Button State
       [not found]     ` <1039324752.3240.6.camel-Ty44UuN9vPJ5T2F9fCU5s856D9/Od9gv@public.gmane.org>
  2002-12-08  5:31       ` James D Strandboge
@ 2002-12-10 13:31       ` Pavel Machek
       [not found]         ` <20021210133100.GC2934-XqDnSF8rrUM@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2002-12-10 13:31 UTC (permalink / raw)
  To: James D Strandboge; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi!

> > 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.
> 
> Nope, and you can't use odd or even either because it changes.  I did
> this:
...
> 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.

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
-- 
				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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Determining Button State
       [not found]         ` <20021210133100.GC2934-XqDnSF8rrUM@public.gmane.org>
@ 2002-12-15 18:41           ` James D Strandboge
  0 siblings, 0 replies; 6+ messages in thread
From: James D Strandboge @ 2002-12-15 18:41 UTC (permalink / raw)
  To: Pavel Machek; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, 2002-12-10 at 08:31, Pavel Machek wrote:
> Hi!
> 
> > > 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.
> > 
> > Nope, and you can't use odd or even either because it changes.  I did
> > this:
> ...
> > 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.
> 
> 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

-- 
Email:        jstrand1-aYIB8uWIUb2Vn7q6wjsIow@public.gmane.org
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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Determining Button State
@ 2002-12-16 18:03 Grover, Andrew
  0 siblings, 0 replies; 6+ messages in thread
From: Grover, Andrew @ 2002-12-16 18:03 UTC (permalink / raw)
  To: 'James D Strandboge', Pavel Machek
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

> From: James D Strandboge [mailto:jstrand1-aYIB8uWIUb2Vn7q6wjsIow@public.gmane.org] 

> 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).

The lid event should just be a signal that OSPM needs to re-read the lid's
status. Reading our lid /proc interface should call the _LID method (which
returns 0 is closed, non-zero if open) and display that info, but that has
yes to be implemented, although it should be pretty easy to do.

Regards -- Andy


-------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-12-16 18:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-08  5:01 Determining Button State Matthew Tippett
     [not found] ` <3DF2D221.7020005-rieW9WUcm8FFJ04o6PK0Fg@public.gmane.org>
2002-12-08  5:19   ` James D Strandboge
     [not found]     ` <1039324752.3240.6.camel-Ty44UuN9vPJ5T2F9fCU5s856D9/Od9gv@public.gmane.org>
2002-12-08  5:31       ` James D Strandboge
2002-12-10 13:31       ` Pavel Machek
     [not found]         ` <20021210133100.GC2934-XqDnSF8rrUM@public.gmane.org>
2002-12-15 18:41           ` James D Strandboge
  -- strict thread matches above, loose matches on Subject: below --
2002-12-16 18:03 Grover, Andrew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox