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: kIOReturnExclusiveAccess from USBInterfaceOpen()



On Thursday, October 2, 2003, at 02:09 PM, Fernando Urbina wrote:

> Kris has a vendor specific device and his kext loads for the device.  I
> imagine that you do a SetConfiguration() and then go looking for the 
> desired
> interface?

That's correct.  Here's the code snippet that sets the configuration 
(from com_line6_L6KUsbIo::initHardware()):

	 fDevice = OSDynamicCast(IOUSBDevice, provider);

     // Find the first config/interface
     if (fDevice->GetNumConfigurations() < 1)
     {
         return false;
     }
     cd = fDevice->GetFullConfigurationDescriptor(0);
     // set the configuration to the first config
     if (!cd)
     {
         return false;
     }
	
     if (!fDevice->open(this))
     {
     	return false;
     }
	
     err = fDevice->SetConfiguration(this, cd->bConfigurationValue, 
true);
     if (err)
     {
         return false;
     }
//-----

Here's the function that returns the interface pointer I try to open.  
I'm using the first interface provided.

IOUSBInterface* com_line6_L6KUsbIo::GetProviderInterface()
{
	IOUSBInterface* iface = NULL;

	IOUSBFindInterfaceRequest request;
	
	request.bInterfaceClass    = kIOUSBFindInterfaceDontCare;
	request.bInterfaceSubClass = kIOUSBFindInterfaceDontCare;
	request.bInterfaceProtocol = kIOUSBFindInterfaceDontCare;
	request.bAlternateSetting  = kIOUSBFindInterfaceDontCare;

	if (fDevice)
	{
		return fDevice->FindNextInterface(NULL, &request);
	}
	else
	{
		return NULL;
	}
}

> I really don't have a good answer on why it would fail.  The
> IOUSBInterface::open() ends up calling IOUSBInterface::handleOpen() so 
> if
> handleOpen fails, you'll get a failure.  What happens at a level 7 
> log?  Is
> there some more info?
>

No, running the logs at level 7 doesn't yield any additional 
information.

Kris Daniel
Line 6, Inc.

(p.s. - My apologies to the usb mailing list for sending the ioreg dump 
& Info.plist information twice.)
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: kIOReturnExclusiveAccess from USBInterfaceOpen() (From: Fernando Urbina <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.