From: Philip Ries [MSFT] on
WinUsb_GetAssociatedInterface:

"The first associated interface is the interface that immediately
follows the interface whose handle the WinUsb_Initialize routine retrieves."

"AssociatedInterfaceIndex [in]
An index that specifies the associated interface to retrieve. A value of
0 indicates the first associated interface, a value of 1 indicates the
second associated interface, and so on."

Use a value of 1 to specify the interface descriptor at index 2.
(Again, that is my own reading and I have not tried this.)

ryan01701 wrote:
> "Philip Ries [MSFT]" wrote:
>
>> Please give WinUsb_GetAssociatedInterface a try, and let us know the result.
>>
>> If the WinUsb_ControlTransfer handling does require the appropriate
>> interface handle to be specified, then I see the issue that Tim pointed
>> out in the documentation of WinUsb_ControlTransfer's InterfaceHandle
>> parameter.
>
> When I try calling this function with AssociatedInterfaceIndex set to 2 (the
> value of the bInterfaceNumber field of the interface descriptor in which I'm
> interested), it fails and GetLastError() reports ERROR_NO_MORE_ITEMS.
>
> Here are the configuration and interface descriptors of interest for the
> device as displayed by UVCView in the WinDDK toolkit:
>
> ===>Configuration Descriptor<===
> bLength: 0x09
> bDescriptorType: 0x02
> wTotalLength: 0x00C1 -> Validated
> bNumInterfaces: 0x03
> bConfigurationValue: 0x01
> iConfiguration: 0x00
> bmAttributes: 0xC0 -> Bus Powered
> MaxPower: 0x00 = 0 mA
>
> ===>Interface Descriptor<===
> bLength: 0x09
> bDescriptorType: 0x04
> bInterfaceNumber: 0x02
> bAlternateSetting: 0x00
> bNumEndpoints: 0x00
> bInterfaceClass: 0xFE -> This is an Application Specific
> USB Device Interface Class
> -> This is a Device Firmware Application Specific USB Device Interface Class
> bInterfaceSubClass: 0x01
> bInterfaceProtocol: 0x00
> CAUTION: This may be an invalid bInterfaceProtocol
> iInterface: 0x00
>
> ===>Descriptor Hex Dump<===
> bLength: 0x07
> bDescriptorType: 0x21
> 07 21 07 88 13 FF 03
>
From: ryan01701 on
"Philip Ries [MSFT]" wrote:

> WinUsb_GetAssociatedInterface:
>
> "The first associated interface is the interface that immediately
> follows the interface whose handle the WinUsb_Initialize routine retrieves."
>
> "AssociatedInterfaceIndex [in]
> An index that specifies the associated interface to retrieve. A value of
> 0 indicates the first associated interface, a value of 1 indicates the
> second associated interface, and so on."
>
> Use a value of 1 to specify the interface descriptor at index 2.
> (Again, that is my own reading and I have not tried this.)

I suppose I should try reading the documentation =) This works as expected;
the wIndex field of my control transfer is correct after calling
GetAssociatedInterface and using that handle for calls into WinUsb.dll.

Thanks very much for the help. Can the API documentation be improved to
indicate that this ste[ is necessary in order to talk to other interfaces?
The libusb Windows backend team would probably like to know this as well.

--
Ryan