Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegisterInterestedDriver problems



From headerdoc
/*! @function registerInterestedDriver
[...]
@param theDriver
The policy-maker adds this pointer to the calling IOService to its list of
interested drivers. It informs drivers on this list pre- and post-power
change.

> // called on "this->"
> registerInterestedDriver(m_ourProvider);
You really have to do:
m_ourProvider->registerInterestedDriver(this);
Now it works. It was not working because I was doing:
registerInterestedDriver(this);
Which was calling myself to register myself! Now the notification works
between classB and classA(see below).

> BUT - I think you're using the wrong API's. Have you considered
> registering your driver with the power management system?
Yes. At first this is what I was doing. Class A (super=IOService,
provider=IOPCIDevice) was doing the steps you described (PMinit,
joinPMtree). It was working up to the point when another driver ClassB
(super=IOService, provider=ClassA) wanted to register as interested on
classA. Then I read the docs again, and realize that classA driver is only
a power controller and not a policyMaker. Then I change the code to do what
the docs says (only do m_IOPCIDevice->registerPowerDriver(this,...)). I made
sure that the IOPCIDevice was a policy -maker (it calls initPM in the
attach). Then classA stopped getting the setPowerState [is the doc wrong ?].

>You can
> declare yourself a "power dependency" of m_ourProvider, and
> automatically get sleep/wake notifications at appropriate times. If
> your driver needs to power itself off on sleep and back on on wakeup,
> then this technique is the way to go.
>
> You'd make the following calls in your start() routine:
> IOService::PMinit(); // initializes private variables in IOService
> IOService::registerPowerDriver(); // registers your power states with
> pm
> IOService::m_ourProvider->joinPMtree(this); // declares your power
> dependency on your provider. This call also
> // defines the order in which drivers are notified of
> sleep/wakeup.
From all the tests I've done, it seems that I will get called in my
setPowerState only if I do all the PMinit and joinPMtree. Otherwise, I will
not get called. Is this normal behavior? This is not what I understood from
the docs.


>
> On Tuesday, August 27, 2002, at 05:09 AM, Francis bouchard wrote:
>
>> I'm having big problems getting this to work. I'm using 10.2(6c115)
>>
>> I have a PCI dirver (IOService) that serves as a provider for another
>> driver. This second driver wants to know when the provider will go to
>> sleep
>> so it can setup itself.
>>
>> // done in the second driver
>> m_ourProvider->registerInterestedDriver(this);
>>
>> Then I implement
>> IOReturn com_matrox_driver_Client::powerStateWillChangeTo(
>> IOPMPowerFlags
>> domainState, unsigned long stateNumber, IOService* whatDevice){...}
>> IOReturn com_matrox_driver_Client:: powerStateDidChangeTo(
>> IOPMPowerFlags
>> domainState, unsigned long stateNumber, IOService* whatDevice){...}
>>
>> The Client's provider is an IOService and his provider is an
>> IOPCIDevice.
>>
>> Now the trouble is that the Client does not get the call to
>> powerStateWillChangeTo and powerStateDidChangeTo when it's provider
>> goes to
>> sleep.
>>
>> Any idea why ?
>> Francis
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: RegisterInterestedDriver problems (From: Ethan Bold <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.