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: Property plugins



Errors are defined in IOReturn.h. If my memory is not too scrambled ,
this would be a case of

#define kIOReturnError iokit_common_err(0x2bc) // general
error

which I agree would be not very explicit. If you look at your driver
entry in the IORegistry (using IOregistryExplorer) do you see any
change there?

Laurent


On Thursday, February 27, 2003, at 05:53 PM, Markus Bollinger wrote:

> Hello!
>
> We have a driver plugin for additionnal specific controls.
> We use IORegistryEntrySetCFProperty() to pass some
> information down to the driver (see Laurent Cerveau's mail below)
>
> This works fine up to OS X 10.2.3
> Now with version 10.2.4 I get the error 0xE00002BC returned from
> this function.
>
> Anybody has an idea where this might come from ?
>
> Best regards,
> Markus.
>
>
>>
>>
>> ----------
>> De : Laurent Cerveau
>> Envoyi : Thursday, December 5, 2002 6:05 AM
>> @ : Emmett James
>> Cc : email@hidden
>> Objet : Re: Property plugins
>>
>> On Thursday, December 5, 2002, at 02:11 PM, Emmett James wrote:
>>
>>> Now my question is, where does this call to
>>> IORegistryEntrySetCFProperty()
>>> end up in the KEXT? In MyAudioDevice:setProperties(OSObject *
>>> properties)?
>>>
>>> If so, what is the nature of the OSbject * properties argument?
>>> In IOAudioControl, I see that this is in fact an OSDictionary.
>>> I have 20 different custom properties. Does this mean my
>>> setProperties()
>>> implementation must look through this dictionary for each of my
>>> properties'
>>> key names to see which one is getting set in this particular call?
>>>
>>> What I would have expected, is that the
>>> IORegistryEntrySetCFProperty()
>>> call would have a more direct analog in the KEXT, e.g. some function
>>> whose arguments were a registry key and a property value.
>>>
>>>
>>
>> Emmett
>>
>> <Preamb> : I may have become rusty on the topic and did not look at
>> the latest incarnation of plugin in CoreAudio so Jeff please correct
>> me
>> if I am outdated :-) </preamb>
>>
>> The property is associated to an an IOAudioControl in your driver that
>> will "receive it". And when you associate an handler with it it will
>> receive the change. Let's take an example. Assuming you are writing a
>> property that will be a float value between 0 and 1. However as you
>> can
>> not do any floating point in the kernel (I mean in general I would not
>> go into the case of clipping functions...) you will create an
>> associated level control that can go from 0 to 128
>>
>> In your driver code you create a level control that does
>>
>> myControlForCustomProperty =
>> IOAudioLevelControl::create(128,0,128,0,
>> 0, kIOAudioControlChannelIDAll, kIOAudioControlChannelNameAll,
>>
>> kCustomPropertyThing,
>> 0, 'cust');
>>
>> if( NULL != myControlForCustomProperty) {
>>
>> myControlForCustomProperty-
>>> setValueChangeHandler((IOAudioControl::IntValueChangeHandler)subRatio
>>> Ch
>> angeHandler, this);
>> myControlForCustomProperty->release();
>> }
>>
>> And you write the appropriate handler .At first in the Plugin open
>> code
>> you need to get a reference to this control (i.e an io_connect_t that
>> we will call gReferenceToMyCustomControl here) Now in your plugin code
>> when you get the custom property passes to your plugin this should be
>> received by your handler.Your plugin code shoudl look like
>>
>> OSStatus AudioDriverPlugInDeviceSetProperty( AudioDeviceID inDevice,
>> const AudioTimeStamp* inWhen,
>> UInt32 inLine,
>> Boolean isInput,
>>
>> AudioDevicePropertyID inPropertyID,
>> UInt32 inPropertyDataSize,
>> const void* inPropertyData){
>> char theProp[5];
>> OSStatus theResult;
>> float theFloatVal, *theFloatValPtr;
>> SInt32 theIntval;
>> CFNumberRef theCFValue;
>>
>> theResult = kAudioHardwareUnknownPropertyError;
>>
>> switch (inPropertyID) {
>> case kCustomPropertyThing:
>> theFloatValPtr = (float *)inPropertyData;
>> theFloatVal = (*theFloatValPtr);
>> if(theFloatVal < 0) theFloatVal = 0;
>> if(theFloatVal > 1) theFloatVal = 1;
>> theIntval = (SInt32) (theFloatVal*128);
>> theCFValue = CFNumberCreate(kCFAllocatorDefault,
>> kCFNumberSInt32Type, &theIntval);
>> theResult =
>> IORegistryEntrySetCFProperty(gReferenceToMyCustomControl,
>> CFSTR("IOAudioControlValue"), theCFValue);
>> CFRelease(theCFValue);
>> theResult = noErr;>
>> break;
>> default:
>> break;
>> }
>>
>> return theResult;
>> }
>>
>> Laurent
>>
>>
>> ------------------------
>> Laurent Cerveau
>> EPM Apple R&D France
>> Applications Division
>> email@hidden
>> _______________________________________________
>> coreaudio-api mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>> Do not post admin requests to the list. They will be ignored.
_______________________________________________
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.



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.