Re: Cancel Sleep
Re: Cancel Sleep
- Subject: Re: Cancel Sleep
- From: Amanda Walker <email@hidden>
- Date: Tue, 1 Jan 2008 21:19:03 -0500
On Jan 1, 2008, at 8:43 PM, Marc Epard wrote:
On Jan 1, 2008, at 7:22 PM, Michael Smith wrote:
Closing the clamshell is an explicit instruction from the user to
sleep the system.
Uh, no.
Well, it has been for most of Apple laptop history :-).
It's the pulling of the cables that is my instruction to sleep. If I
close the lid, but leave the keyboard, external monitor, and power
connected, I intend to simply reduce my screen real estate to just
the external monitor.
Hmm. At best I'd say it's the combination of closing the lid and
unplugging the cables. I plug and unplug stuff all the time, and I'd
be very annoyed if my machine went to sleep when I unplugged a monitor
or USB mouse.
Going back to Andrew's question, though. Andrew, there is no cookbook
answer, since there's no API for doing the particular things you
want. This means you will need to use undocumented mechanisms, which
may take some experimentation, and may be fragile when Apple changes
the OS. This doesn't mean that you can't do so (many shipping
products do undocumented or unsupported things), it just means that no
one has a simple answer to give you.
Too illustrate this, here's how I'd approach the problem if I were
trying to change the system's behavior in this way:
- Download the kernel sources and study them carefully.
- Write an IOKit driver that always loads
- When the driver starts, have it patch the running kernel to
interpose your code (the easiest way is to patch the function prolog
for a notification bottleneck, if one exists).
- To be extra friendly, allow the behavior to be turned on and off via
the driver's user client, so that you can hook it up to a prefpane,
control it from an application, etc. The driver's workloop may also
be handy as a way to do periodic processing, catch interrupts, etc. if
you need it.
- Your driver must never unload.
- You must declare the kernel dependencies correctly so that it only
loads into versions of the kernel that you've tested it on to confirm
that it's compatible.
If you want to know which specific calls to interpose on, and code for
doing that (that is, you want someone to do the actual work involved),
there are probably quite a number of people on darwin-drivers that
have the requisite knowledge. The last time I did IOKit consulting my
hourly rate was $150/hr, but you could probably find someone cheaper.
If you are not comfortable writing code that patches a running kernel,
perhaps this is not the best project :-).
--Amanda
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden