Home    Prev Next    
Contents
Programming For USB Device
Overview
Programmers Guide
Scenario
Data transfer
Synchronous Transfer
Asynchronous Transfer
Reading Descriptors
USB Support Routines And Structures
Common Procedures
UsbEnumerateDevices
OpenRapidUsb
IsRapidUsbOpened
CloseRapidUsb
Descriptors
UsbGetDescriptor
UsbGetDeviceDescriptor
UsbGetStringDescriptor
UsbGetConfigDescriptor
UsbFreeConfigDescriptor
UsbGetInterfaceDescriptor
UsbFreeInterfaceDescriptor
UsbGetEndpointDescriptor
Configure Device
UsbGetDeviceInfo
UsbUnconfigureDevice
UsbSelectConfig
UsbGetConfig
UsbSelectInterface
UsbGetInterface
UsbResetDevice
UsbGetBandwidthInfo
UsbCyclePort
Features and Status
UsbSetFeature
UsbClearFeature
UsbGetStatus
Vendor/Class Requests
UsbVendorRequestIn
UsbVendorRequestOut
UsbClassRequestIn
UsbClassRequestOut
Pipes
IsRapidUsbPipeOpened
UsbPipeOpen
UsbPipeClose
UsbGetPipeCount
UsbPipeGetInfo
UsbPipeDirectionIn
UsbPipeGetType
UsbTransfer
UsbTransferAsync
TRANSFER_COMPLETION_ROUTINE
UsbCancelTransfer
UsbPipeReset
UsbPipeAbort
Other
UsbGetPortStatus
UsbGetCurrentFrameNumber
USB Structures and Types
RDUSB_DEVICE_INFORMATION
RDUSB_PIPE_INFORMATION
RDUSB_PIPE_TYPE
RDUSB_BANDWIDTH_INFORMATION
UsbGetDescriptor
Go to RapidDriver Main Page


Language

Description

C/C++
BOOL UsbGetDescriptor(IN USB_DEVICE_HANDLE hUsb,
IN RDUSB_REQUEST_RECIPIENT RequestRecipient,  
IN UCHAR Type,  
IN UCHAR Index,  
OUT PUSB_COMMON_DESCRIPTOR pDescr,  
IN ULONG DescriptorLength);  
Delphi
function UsbGetDescriptor(hUsb             : USB_DEVICE_HANDLE;
                          RequestRecipient : RDUSB_REQUEST_RECIPIENT;
                          DescrType        : UCHAR;
                          Index            : UCHAR;
                          var Descr        : USB_COMMON_DESCRIPTOR;
                          Length           : ULONG) : BOOL; stdcall;

VB
Function UsbGetDescriptor(ByVal hUsb As Long, _
                          ByVal RequestRecipient As Byte, _
                          ByVal bType As Byte, _
                          ByVal Index As Byte, _
                          ByRef pDescr As USB_COMMON_DESCRIPTOR, _
                          ByVal DescrLength As Long) As Boolean



Parameters
 
hUsb  
Specifies handle to USB device.  
 
RequestRecipient  
Specifies recipient of get descriptor request.  
 
Type  
Indicates what type of descriptor is being retrieved.      
 
Index  
Descriptor index.  
 
pDescr  
Pointer to user allocated memory block. Retrieved descriptor is saved to this buffer on function successful return.  
 
DescriptorLength  
Specifies length of pDescr buffer.  
 
Return Value

If function fails it return FALSE. To detect error call GetLastError function.  

Description
 
Use this function to retrieve descriptor of any type. This function can be used only after getting valid handle from OpenRapidUsb function. User must allocate memory buffer which points to pDescr before handling pointer parameter to function.  

Note
To get class specific descriptor (e.g. Hub descriptor class) use function UsbClassRequestIn.