Re: plugin to query hardware status
Re: plugin to query hardware status
- Subject: Re: plugin to query hardware status
- From: Jeff Moore <email@hidden>
- Date: Tue, 9 May 2006 14:23:45 -0700
On May 9, 2006, at 2:05 PM, david tay wrote:
One easy way to do this is to just use the IORegistry. The user-land
code would just get/set values in the IORegistry entries of your
driver objects. The upside of this is that it is really easy to
implement both in user-space and in your kernel objects. The downside
of it is that the IORegistry has to do a lot of work to move the data
between the kernel and user-space. So, you wouldn't want to do it
this way if you are expecting to have to query/change this
information a lot.
I'm able to set the values just fine. However, when getting values,
those values must first be set in the IORegistry.
Would it be possible to override some function to provide access
to the user client object?
I'm not at all sure what you mean, so let me give you an example of
what I did to implement a custom property that isn't an
IOAudioControl in a driver for a virtual device I use for testing.
The property in question is used to control the number of channels
the device has. It is a simple integer value. So all I did was put it
into the IORegistry hanging off of my IOAudioEngine subclass. To put
it in the registry, I just call setProperty() using a custom key. To
receive changes to this value, I had to override setProperties() in
my IOAudioEngine subclass. In my implementation of setProperties(), I
just look for my custom key, grab the value and process it if the
value is different.
In my HAL plug-in, all I ever do to access/manipulate this property
is to call IORegistryEntryCreateCFProperty() or
IORegistryEntrySetCFProperty().
In my particular case, changing my custom property changed the format
of the data since it specifically is there to adjust the number of
channels. Because of this, my custom property didn't need any
notifications over and above what the IOAudio Family already
provided, namely the major engine change and format change
notifications.
If your custom property needs notifications separate from what the
Family provides, the best thing to do is to just define your own
notification ID and use it in a call to
IOAudioEngine::sendNotification(). Either way, your plug-in will need
to open it's own connection to your engine object and give it a mach
port on which to send the notifications.
Hope this helps.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden