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


Language

Description

C/C++
BOOL UsbClassRequestIn(IN USB_DEVICE_HANDLE hUsb,
IN RDUSB_REQUEST_RECIPIENT RequestRecipient,  
IN UCHAR ReservedBits,  
IN UCHAR Request,  
IN USHORT Value,  
IN USHORT Index,  
IN const LPVOID lpBuffer,  
IN DWORD nNumberOfBytesToTransfer,  
OUT LPDWORD lpNumberOfBytesTransfered);  

Delphi
function UsbClassRequestIn(hUsb                            : USB_DEVICE_HANDLE;
                            RequestRecipient               : RDUSB_REQUEST_RECIPIENT;
                            ReservedBits                   : UCHAR;
                            Request                        : UCHAR;
                            Value                          : USHORT;
                            Index                          : USHORT;
                            var Buffer;
                            nNumberOfBytesToTransfer       : DWORD;
                            var lpNumberOfBytesTransfered  : DWORD): BOOL; stdcall;

VB
Function UsbClassRequestIn (ByVal hUsb As Long, _
                            ByVal RequestRecipient As Byte, _
                            ByVal ReservedBits As Byte, _
                            ByVal Request As Byte, _
                            ByVal Value As Integer, _
                            ByVal Index As Integer, _
                            ByRef Buffer As Any, _
                            ByVal NumberOfBytesToTransfer As Long, _
                            ByRef NumberOfBytesTransfered As Long) As Boolean


Parameters

hUsb  
Device handle. This handle can be obtained with OpenRapidUsb.  
 
RequestRecipient  
Specifies recipient of feature request.  
 
ReservedBits  
Specifies a value, from 4 to 31 inclusive, that becomes part of the request type code in the USB-defined setup packet. This value is defined by USB for a class request.  
 
Request  
Specifies USB-defined request code for the RequestRecipient.  
 
 
Value  
Specifies a value, specific to Request, that becomes part of the USB-defined setup packet for the RequestRecipient. This value is defined by the creator of the code used in Request.  
 
Index  
Specifies the device-defined index, returned by a successful configuration request, if the request is for an endpoint or interface. Otherwise, Index must be zero.  
 
lpBuffer  
Output parameter. Pointer to buffer for the transfer. This buffer will contain data read from the device.  
 
nNumberOfBytesToTransfer  
Specifies the length, in bytes, of the buffer specified in lpBuffer.  
 
lpNumberOfBytesTransfered  
UsbClassRequestIn returns the number of bytes read from device in this parameter.  

Return Value

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

Description
 
UsbClassRequestIn is called to issue a class-specific command to a device, interface, endpoint or other device-defined target. Transfer direction is from device to host (IN).