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
Scenario
Go to RapidDriver Main Page

Before using any of the functions of RapidUSB interface DLL must be intinalized with call to UsbEnumerateDevices. After this friver can be requested to open handle of one of the devices enumerated during call to UsbEnumerateDevices. This is done with the help of the function OpenRapidUSB. It must be done once after starting the application. Also resources used by the driver should be cleaned up (CloseRapidUsb) before the application is closed.

Schematic session of using RapidUSB:
 
 
// find RapidUSB devices  
nDevices = UsbEnumerateDevices();  
 
if ( nDevices < 1 )  
{  
// no RapidUSB devices present in system  
MessageBox("Cannot find any RapidUSB device!","Attention!", MB_OK | MB_ICONWARNING);     
return;  
}  
 
// initialize(open) the driver  
hUSB =  OpenRapidUSB( 0 );   
 
// Check if the driver initialized successfully  
 
if ( IsRapidUSBOpened(hUSB)) {   
     ...   
//////////////////////////////////////  
/////////  RapidUSB session //////////  
/////////  ................ //////////  
//////////////////////////////////////  
 
// Free resources used by the driver (close the driver)           
 
hUSB = CloseRapidUSB(hUSB);   
 
}  
else    
{  
// An error happened while opening the driver  
MessageBox("Cannot open the driver","Attention!", MB_OK | MB_ICONWARNING);     
}  

Driver can be initialized by many applications simultaneously. The parameter of OpenRapidUSB() can be used to select a device supported by RapidUSB driver.