All the error codes are in the header files, a 2 second grep for 2cd gives you
..
#define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open
Did you open() the device before you called the function? That too was in
Fernando’s post back in November
"There is a user space API to do that in IOUSBLib.h. You just need to
have the device open() before you call the API."
> On 16 Dec 2014, at 07:55, Carl Hoefs <[email protected]> wrote:
>
> Okay, now I’m at the point where I can call USBDeviceReEnumerate(), but it
> fails to re-enumerate the device, returning error code 0xe00002cd
> (-536870195). Any ideas on what that means?
> -Carl
>
> On Dec 15, 2014, at 4:23 PM, Roland King <[email protected]> wrote:
>
>> You need to declare it as IOUSBDeviceInterface187 (or later) because the
>> structure doesn’t have that function in it until that version.
>>
>>> On 16 Dec 2014, at 07:21, Carl Hoefs <[email protected]> wrote:
>>>
>>> I’m doing the following:
>>>
>>> IOUSBDeviceInterface **deviceInterface;
>>>
>>> and then
>>>
>>> HRESULT result;
>>> kern_return_t kret;
>>> IOCFPlugInInterface **plugInInterface = NULL;
>>>
>>> kret = IOCreatePlugInInterfaceForService(usbDevice,
>>> kIOUSBDeviceInterfaceID187,
>>> kIOCFPlugInInterfaceID,
>>> &plugInInterface, &score);
>>>
>>> result = (*plugInInterface)->QueryInterface(plugInInterface,
>>> CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID187),
>>> (LPVOID*) &deviceInterface);
>>>
>>> Do I need to declare the IOUSBDeviceInterface differently, or am I out in
>>> left field?
>>> -Carl
>>>
>>>
>>> On Dec 15, 2014, at 3:44 PM, Fernando Urbina <[email protected]> wrote:
>>>
>>>> Are you creating the appropriate IOUSBDeviceInterface? You need to create
>>>> one that matches the version where USBDeviceReEnumerate was intro’d:
>>>>
>>>> kIOUSBDeviceInterfaceID187
>>>>
>>>>
>>>>
>>>>
>>>>> On Dec 15, 2014, at 3:37 PM, Carl Hoefs <[email protected]>
>>>>> wrote:
>>>>>
>>>>> Thanks for the pointer. Yes, this is from within a user-mode OS X app. I
>>>>> can do everything successfully but call the USBDeviceReEnumerate()
>>>>> function.
>>>>>
>>>>> In a nutshell, I iterate through IOIteratorNext():
>>>>> If there is a match of vid/pid:
>>>>> invoke IORegistryEntryGetName()
>>>>> invoke IORegistryEntryGetPath()
>>>>> invoke IORegistryEntryCreateCFProperties()
>>>>> invoke IOCreatePlugInInterfaceForService()
>>>>> invoke QueryInterface() to get the device interface
>>>>> (all of the above works successfully)
>>>>> and then try to invoke USBDeviceReEnumerate(), which seems to exist in
>>>>> the Twilight Zone.
>>>>>
>>>>> But Xcode doesn’t resolve the function. I can manually place a function
>>>>> prototype in my code to get it to build, but at runtime, when it invokes
>>>>> USBDeviceReEnumerate(), it crashes with a EXC_BAD_ACCESS due to the
>>>>> function’s unresolved address being 0x00000000. This happens both on 10.9
>>>>> and 10.10 systems.
>>>>>
>>>>> If there were sample code that actually invoked USBDeviceReEnumerate(),
>>>>> that would be great. Somehow it appears to exist, but just beyond my
>>>>> reach…
>>>>>
>>>>> -Carl
>>>>>
>>>>>
>>>>> On Dec 15, 2014, at 3:10 PM, Fernando Urbina <[email protected]> wrote:
>>>>>
>>>>>> You need to take a look at some of the sample code in order to
>>>>>> understand how to use IOUSBLib.h. This is one of my favorite sample
>>>>>> code snippets:
>>>>>>
>>>>>> https://developer.apple.com/library/mac/samplecode/USBPrivateDataSample/Introduction/Intro.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> Woof,
>>>>>>
>>>>>> Nano Urbina
>>>>>> Build Slave
>>>>>> Razz Software
>>>>>> http://www.razzsoftware.com
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Usb mailing list ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/usb/rols%40rols.org
>>>
>>> This email sent to [email protected]
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/usb/archive%40mail-archive.com
This email sent to [email protected]