Language
|
Description
|
C/C++
|
BOOL UsbGetConfigDescriptor(IN USB_DEVICE_HANDLE hUsb,
| OUT PUSB_CONFIGURATION_DESCRIPTOR* pConfDescr);
|
|
Delphi
|
function UsbGetConfigDescriptor(hUsb : USB_DEVICE_HANDLE;
Index : UCHAR;
var pConfigDescr : PUSB_CONFIGURATION_DESCRIPTOR) : BOOL; stdcall;
|
VB
|
Function UsbGetConfigDescriptor (ByVal hUsb As Long, _
ByVal ConfIndex As Byte, _
ByRef pDesc As Long) As Boolean
|
Parameters
| Specifies handle to USB device
|
| Device-defined index of configuration descriptor.
|
| Pointer to retrieved configuration descriptor.
|
Return Value
| If function fails it return FALSE. To detect error call GetLastError function.
|
Description
| Use this function to retrieve configuration descriptor. This function can be used only after getting valid handle from OpenRapidUsb function. Do not forget to free descriptor after use with UsbFreeConfigDescriptor.
|
Example
// open first RapidUSB device
USB_HANDLE hUsb = OpenRapidUsb(0);
PUSB_CONFIGURATION_DESCRIPTOR pConfDesc;
UsbGetConfigDescriptor(hUsb, 0, pConfDesc);
if (pConfDesc != NULL)
{
// configuration retrieved successfully
// work with descriptor
// ....................
// Free memory allocated for descriptor
UsbFreeConfigDescriptor(pConfDesc);
}
else
{
// Error! Check if hUsb is valid
}
CloseRapidUsb(hUsb);
|