Pismo: How to check if the lid is closed.

2 messages, 2 authors, 2001-08-28 · open the first message on its own page

Pismo: How to check if the lid is closed.

From: Henning Brinkmann <hidden>
Date: 2001-08-28 07:55:04

Hello all.

I'm trying to write a minimal replacement for pmud that only monitors
the state of the lid and sends my pismo to sleep if the lid is closed.

I found out from pmud's source code how to send it to sleep but I
did not understand how to check if the lid is closed. I also had no
luck searching for documentation about how to do it.

Does anyone have link to some documentation concerning that issue?

Thanks in advance

	Henning

--
Diplom Inform. Henning Brinkmann
OFFIS, Escherweg 2, D-26125 Oldenburg
Phone: +49 441 798 2374
mailto:Henning.Brinkmann@offis.de

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

Re: Pismo: How to check if the lid is closed.

From: Michael Schmitz <hidden>
Date: 2001-08-28 12:37:50

I found out from pmud's source code how to send it to sleep but I
did not understand how to check if the lid is closed. I also had no
luck searching for documentation about how to do it.
I think the lid state is encoded in the pmu data packets that pmud polls
for every second.

In poll_pmu():

	if (pmu_op(PMU_GET_COVER, 0, 0, &switches, 1, "switch req") < 0)
		return;

 	if ((switches & 1) != 0)
	{
	 	syslog(LOG_INFO, "lid closed: request sleep");
	 	chloralhydrate = 1;     /* lid is closed, go to sleep */
	}

So basically you need to send the PMU a specific request for information
(PMU_GET_COVER) and test bit 1 of the response byte.
Does anyone have link to some documentation concerning that issue?
:-) This is Apple. The Darwin source might be your best bet. Or the pmud
source above, if you don't care about the meaning of the other bytes in
the PMU_GET_COVER response.

	Michael


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help