IORegistryEntrySetCFProperty in AudioDriverPlugInStreamSetProperty
I have write an audio driver plugin that work correctly with Mac OS X 10.2.3, but with 10.2.6 I have the following problem. I use a specific control in the Audio stream plugin driver to change a value in the driver (See sample code below). In the AudioDriverPlugInStreamSetProperty, I use the IORegistryEntrySetCFProperty function that return 0xE00002BC I think that the 0xE00002BC error code is : #define kIOReturnError iokit_common_err(0x2bc) // general error Could someone explain why this error is returned with Mac OS X 10.2.6 ? I have the same problem with Mac OS X 10.2.3 and G4 DP 1.2 Ghz, not with G4 DP 867 and G3 350. Thanks in advance for your help, Alain This is a sample code of the audio driver plugin : // **************************************************************************** // AudioDriverPlugInStreamSetProperty // **************************************************************************** OSStatus AudioDriverPlugInStreamSetProperty( AudioDeviceID PmDevice, io_object_t PmIOAudioStream, const AudioTimeStamp* PmWhen, UInt32 PmChannel, AudioDevicePropertyID PmPropertyID, UInt32 PmPropertyDataSize, const void* PmPropertyData) { OSStatus LcResult; SInt32 *LcSInt32Ptr; SInt32 LcSInt32; CFNumberRef LcCFNumberRef; LcResult = kAudioHardwareUnknownPropertyError; switch (PmPropertyID) { // ******************************* // Mpeg header // ******************************* case kPropertyMpegHeader: LcResult = noErr; LcSInt32Ptr = (SInt32*) PmPropertyData; LcSInt32 = *LcSInt32Ptr; #ifdef DEBUG_SETSTREAM fprintf( stdout, "%s() : *** --> kPropertyMpegHeader : set PropertyData = 0x%0lX \n", __FUNCTION__, LcSInt32 ); fflush(stdout); #endif LcCFNumberRef = CFNumberCreate( CFAllocatorGetDefault(), kCFNumberSInt32Type, &LcSInt32 ); LcResult = IORegistryEntrySetCFProperty( gConnectionReferenceToControlMpegHeader, CFSTR("IOAudioControlValue"), LcCFNumberRef ); CFRelease(LcCFNumberRef); #ifdef DEBUG_SETSTREAM fprintf( stdout, "%s() : IORegistryEntrySetCFProperty(0x%0X, IOAudioControlValue) LcResult = 0x%0lX %ld \n", __FUNCTION__, gConnectionReferenceToControlMpegHeader, LcResult, LcResult ); fflush(stdout); #endif break; default: break; } return LcResult; } Someone tell me to replace the CFNumberCreate with CFDataCreate. I try it, and I have no error in the IORegistryEntrySetCFProperty function but the value in the IORegistry did not change. This is a sample code of my driver : // **************************************************************************** // **************************************************************************** bool myAudioEngine::initHardware(IOService *provider) { ... // ****************************************** // Create CUSTOM control : Mpeg header // ****************************************** mControlMpegHeader = IOAudioLevelControl::create( CVAL_HEADMPEG_MIN, // Initial value CVAL_HEADMPEG_MIN, // min value : CVAL_HEADMPEG_MAX, // max value : CVAL_HEADMPEG_MIN, // min dB CVAL_HEADMPEG_MAX, // max dB 0, "Mpeg header", kPropertyMpegHeaderCtrlID, // control ID - driver-defined 0, // subType kPropertyMpegHeader ); if (!mControlMpegHeader) { ERRORLOG( " IOAudioLevelControl::mControlMpegHeader() \n" ); return; } // -------------------------------------------------------------------------- mControlMpegHeader->setValueChangeHandler( (IOAudioControl::IntValueChangeHandler)setMpegHeaderChangeHandler, this ); PmAudioStream->addDefaultAudioControl(mControlMpegHeader); mControlMpegHeader->release(); ... } // **************************************************************************** // MPEG HEADER CHANGE HANDLER // **************************************************************************** IOReturn myAudioEngine::setMpegHeaderChangeHandler( IOService *target, IOAudioControl *mpegHeaderControl, SInt32 oldValue, SInt32 newValue) { IOReturn result = kIOReturnBadArgument; myAudioEngine *audioEngine; DOUT( DBG_MESSAGE, (" ** %s() : target = %p mpegHeaderControl = %p \n", __FUNCTION__, target, mpegHeaderControl )); audioEngine = (myAudioEngine *)target; if (audioEngine) { result = audioEngine->setMpegHeaderChanged( mpegHeaderControl, oldValue, newValue); } return result; } // **************************************************************************** // MPEG HEADER CHANGED // **************************************************************************** IOReturn myAudioEngine::setMpegHeaderChanged( IOAudioControl *mpegHeaderControl, SInt32 oldValue, SInt32 newValue) { if (mpegHeaderControl) { DOUT( DBG_CLOCK, (" ** %s() : Channel %ld, MpegHeader = 0x%0lX \n", __FUNCTION__, mpegHeaderControl->getChannelID(), newValue )); // Set Mpeg Header mMpegHeader = newValue; } return kIOReturnSuccess; } _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Alain Crétet