libusbK 
3.0
Library Documentation
© 2011-2021 Travis Lee Robinson. All rights reserved.
libusbk.h File Reference

functions for usb device communication. More...

#include "lusbk_shared.h"
#include <pshpack1.h>
#include <poppack.h>

Go to the source code of this file.

Data Structures

union  KUSB_SETUP_PACKET
 KUSB control setup packet. More...
 
struct  KLIB_VERSION
 libusbK verson information structure. More...
 
struct  KLST_DEV_COMMON_INFO
 Common usb device information structure. More...
 
struct  KLST_DEVINFO
 Semi-opaque device information structure of a device list. More...
 
struct  KLST_PATTERN_MATCH
 Device list/hot-plug pattern match structure. More...
 
struct  USB_DEVICE_DESCRIPTOR
 A structure representing the standard USB device descriptor. More...
 
struct  USB_ENDPOINT_DESCRIPTOR
 A structure representing the standard USB endpoint descriptor. More...
 
struct  PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR
 A structure representing additional information about super speed (or higher) endpoints. More...
 
struct  PBOS_DEV_CAPABILITY_DESCRIPTOR
 BOS device capability descriptor. More...
 
struct  PBOS_DESCRIPTOR
 USB 3.0 and USB 2.0 LPM Binary Device Object Store (BOS). More...
 
struct  PBOS_USB_2_0_EXTENSION_DESCRIPTOR
 USB 2.0 Extension descriptor. More...
 
struct  PBOS_SS_USB_DEVICE_CAPABILITY_DESCRIPTOR
 SuperSpeed Device Capability Descriptor. More...
 
struct  PBOS_CONTAINER_ID_DESCRIPTOR
 Container ID Descriptor. More...
 
struct  PBOS_PLATFORM_DESCRIPTOR
 Platform specific capabilities. More...
 
struct  PBOS_WINDOWS_PLATFORM_VERSION
 This structure represents the windows version records that follow a BOS windows platform descriptor. More...
 
struct  PUSB_MSOSV1_STRING_DESCRIPTOR
 Special Microsoft string descriptor used to indicate that a device supports Microsoft OS V1.0 descriptors. More...
 
struct  PMSOSV1_FUNCTION_DESCRIPTOR
 A function section defines the compatible ID and a subcompatible ID for a specified interface or function. More...
 
struct  PMSOSV1_CUSTOM_PROP_DESCRIPTOR
 A custom property section contains the information for a single property. More...
 
struct  PMSOS_CUSTOM_PROP_ELEMENT
 Helper structure for parsing a /ref MSOSV1_CUSTOM_PROP_DESCRIPTOR or a MSOSV2_FEATURE_REG_PROPERTY_DESCRIPTOR. More...
 
struct  PMSOSV2_COMMON_DESCRIPTOR
 All MS OS V2.0 descriptors start with these two fields. More...
 
struct  PMSOSV2_SET_HEADER_DESCRIPTOR
 Microsoft OS 2.0 descriptor set header. More...
 
struct  PMSOSV2_SUBSET_HEADER_CONFIGURATION_DESCRIPTOR
 Microsoft OS 2.0 configuration subset header. More...
 
struct  PMSOSV2_SUBSET_HEADER_FUNCTION_DESCRIPTOR
 Microsoft OS 2.0 function subset header. More...
 
struct  PMSOSV2_FEATURE_COMPATBLE_ID_DESCRIPTOR
 Microsoft OS 2.0 compatible ID descriptor. More...
 
struct  PMSOSV2_FEATURE_REG_PROPERTY_DESCRIPTOR
 Microsoft OS 2.0 registry property descriptor. More...
 
struct  PMSOSV2_FEATURE_MIN_RESUME_TIME_DESCRIPTOR
 Microsoft OS 2.0 minimum USB resume time descriptor. More...
 
struct  PMSOSV2_FEATURE_MODEL_ID_DESCRIPTOR
 Microsoft OS 2.0 model ID descriptor. More...
 
struct  PMSOSV2_FEATURE_CCGP_DESCRIPTOR
 Microsoft OS 2.0 CCGP device descriptor. More...
 
struct  PMSOSV2_FEATURE_VENDOR_REVISION_DESCRIPTOR
 Microsoft OS 2.0 vendor revision descriptor. More...
 
struct  USB_CONFIGURATION_DESCRIPTOR
 A structure representing the standard USB configuration descriptor. More...
 
struct  USB_INTERFACE_DESCRIPTOR
 A structure representing the standard USB interface descriptor. More...
 
struct  USB_STRING_DESCRIPTOR
 A structure representing the standard USB string descriptor. More...
 
struct  USB_COMMON_DESCRIPTOR
 A structure representing the common USB descriptor. More...
 
struct  USB_INTERFACE_ASSOCIATION_DESCRIPTOR
 Allows hardware manufacturers to define groupings of interfaces. More...
 
struct  KUSB_DRIVER_API_INFO
 USB core driver API information structure. More...
 
struct  KUSB_DRIVER_API
 Driver API function set structure. More...
 
struct  KHOT_PARAMS
 Hot plug parameter structure. More...
 
struct  KSTM_XFER_CONTEXT
 Stream transfer context structure. More...
 
struct  KSTM_INFO
 Stream information structure. More...
 
struct  KSTM_CALLBACK
 Stream callback structure. More...
 

Macros

#define KUSB_EXP
 Indicates that a function is an exported API call.
 
#define KUSB_API   WINAPI
 Indicates the calling convention. This is always WINAPI (stdcall) by default.
 
#define KLST_STRING_MAX_LEN   256
 Allocated length for all strings in a KLST_DEVINFO structure.
 
#define USBD_ISO_START_FRAME_RANGE   1024
 Maximum value that can be added to the current start frame.
 
#define MAXIMUM_USB_STRING_LENGTH   255
 Maximum length (in bytes) of a usb string. USB strings are always stored in wide-char format.
 
#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i)   ((USHORT)((USHORT)d<<8 | i))
 Makes wValue for a USB_REQUEST_GET_DESCRIPTOR or USB_REQUEST_SET_DESCRIPTOR request.
 
#define USB_ENDPOINT_TYPE_MASK   0x03
 Endpoint type mask for the bmAttributes field of a USB_ENDPOINT_DESCRIPTOR.
 
#define USB_ENDPOINT_TYPE_CONTROL   0x00
 Indicates a control endpoint.
 
#define USB_ENDPOINT_TYPE_ISOCHRONOUS   0x01
 Indicates an isochronous endpoint.
 
#define USB_ENDPOINT_TYPE_BULK   0x02
 Indicates a bulk endpoint.
 
#define USB_ENDPOINT_TYPE_INTERRUPT   0x03
 Indicates an interrupt endpoint.
 
#define USB_CONFIG_POWERED_MASK   0xc0
 Config power mask for the bmAttributes field of a USB_CONFIGURATION_DESCRIPTOR.
 
#define USB_ENDPOINT_DIRECTION_MASK   0x80
 Endpoint direction mask for the bEndpointAddress field of a USB_ENDPOINT_DESCRIPTOR.
 
#define USB_ENDPOINT_ADDRESS_MASK   0x0F
 Endpoint address mask for the bEndpointAddress field of a USB_ENDPOINT_DESCRIPTOR.
 
#define USB_ENDPOINT_DIRECTION_OUT(addr)   (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
 Tests the bEndpointAddress direction bit. TRUE if the endpoint address is an OUT endpoint. (HostToDevice, PC Write) More...
 
#define USB_ENDPOINT_DIRECTION_IN(addr)   ((addr) & USB_ENDPOINT_DIRECTION_MASK)
 Tests the bEndpointAddress direction bit. TRUE if the endpoint address is an IN endpoint. (DeviceToHost, PC Read) More...
 

Typedefs

typedef INT_PTR KLIB_USER_CONTEXT
 User defined handle context space, see LibK_GetContext.
 
typedef void * KLIB_HANDLE
 Base handle type for all library handles, See KLIB_HANDLE_TYPE.
 
typedef KLIB_HANDLE KUSB_HANDLE
 Opaque UsbK handle, see UsbK_Init.
 
typedef KLIB_HANDLE KLST_HANDLE
 Opaque LstK handle, see LstK_Init.
 
typedef KLIB_HANDLE KHOT_HANDLE
 Opaque HotK handle, see HotK_Init.
 
typedef KLIB_HANDLE KOVL_HANDLE
 Opaque OvlK handle, see OvlK_Acquire.
 
typedef KLIB_HANDLE KOVL_POOL_HANDLE
 Opaque OvlPoolK handle, see OvlK_Init.
 
typedef KLIB_HANDLE KSTM_HANDLE
 Opaque StmK handle, see StmK_Init.
 
typedef KLIB_HANDLE KISOCH_HANDLE
 Opaque IsochK handle, see IsochK_Init.
 
typedef INT KUSB_API KLIB_HANDLE_CLEANUP_CB (_in KLIB_HANDLE Handle, _in KLIB_HANDLE_TYPE HandleType, _in KLIB_USER_CONTEXT UserContext)
 Function typedef for LibK_SetCleanupCallback.
 
typedef KLIB_VERSIONPKLIB_VERSION
 Pointer to a
 
typedef BOOL KUSB_API KISO_ENUM_PACKETS_CB (_in UINT PacketIndex, _in PKISO_PACKET IsoPacket, _in PVOID UserState)
 Callback function typedef for IsoK_EnumPackets.
 
typedef BOOL KUSB_API KISOCH_ENUM_PACKETS_CB (_in UINT PacketIndex, _ref PUINT Offset, _ref PUINT Length, _ref PUINT Status, _in PVOID UserState)
 Callback function typedef for IsochK_EnumPackets.
 
typedef KLST_DEV_COMMON_INFOPKLST_DEV_COMMON_INFO
 Pointer to a KLST_DEV_COMMON_INFO structure.
 
typedef KLST_DEVINFOKLST_DEVINFO_HANDLE
 Pointer to a KLST_DEVINFO structure. (semi-opaque)
 
typedef KLST_PATTERN_MATCHPKLST_PATTERN_MATCH
 Pointer to a KLST_PATTERN_MATCH structure.
 
typedef BOOL KUSB_API KLST_ENUM_DEVINFO_CB (_in KLST_HANDLE DeviceList, _in KLST_DEVINFO_HANDLE DeviceInfo, _in PVOID Context)
 Device list enumeration function callback typedef. More...
 
typedef USB_DEVICE_DESCRIPTORPUSB_DEVICE_DESCRIPTOR
 pointer to a USB_DEVICE_DESCRIPTOR
 
typedef USB_ENDPOINT_DESCRIPTORPUSB_ENDPOINT_DESCRIPTOR
 pointer to a USB_ENDPOINT_DESCRIPTOR
 
typedef
USB_CONFIGURATION_DESCRIPTOR
PUSB_CONFIGURATION_DESCRIPTOR
 pointer to a USB_CONFIGURATION_DESCRIPTOR
 
typedef USB_INTERFACE_DESCRIPTORPUSB_INTERFACE_DESCRIPTOR
 pointer to a USB_INTERFACE_DESCRIPTOR
 
typedef USB_STRING_DESCRIPTORPUSB_STRING_DESCRIPTOR
 pointer to a USB_STRING_DESCRIPTOR
 
typedef USB_COMMON_DESCRIPTORPUSB_COMMON_DESCRIPTOR
 pointer to a USB_COMMON_DESCRIPTOR
 
typedef
USB_INTERFACE_ASSOCIATION_DESCRIPTOR
PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR
 pointer to a USB_INTERFACE_ASSOCIATION_DESCRIPTOR
 
typedef VOID KUSB_API KHOT_PLUG_CB (_in KHOT_HANDLE HotHandle, _in KLST_DEVINFO_HANDLE DeviceInfo, _in KLST_SYNC_FLAG PlugType)
 Hot plug event function definition.
 
typedef VOID KUSB_API KHOT_POWER_BROADCAST_CB (_in KHOT_HANDLE HotHandle, _in KLST_DEVINFO_HANDLE DeviceInfo, _in UINT PbtEvent)
 Power broadcast event function definition.
 
typedef KHOT_PARAMSPKHOT_PARAMS
 Pointer to a KHOT_PARAMS structure.
 
typedef KSTM_XFER_CONTEXTPKSTM_XFER_CONTEXT
 Pointer to a KSTM_XFER_CONTEXT structure.
 
typedef KSTM_INFOPKSTM_INFO
 Pointer to a KSTM_INFO structure.
 
typedef KSTM_CALLBACKPKSTM_CALLBACK
 Pointer to a KSTM_CALLBACK structure.
 

Enumerations

enum  KLIB_HANDLE_TYPE {
  KLIB_HANDLE_TYPE_HOTK,
  KLIB_HANDLE_TYPE_USBK,
  KLIB_HANDLE_TYPE_USBSHAREDK,
  KLIB_HANDLE_TYPE_LSTK,
  KLIB_HANDLE_TYPE_LSTINFOK,
  KLIB_HANDLE_TYPE_OVLK,
  KLIB_HANDLE_TYPE_OVLPOOLK,
  KLIB_HANDLE_TYPE_STMK,
  KLIB_HANDLE_TYPE_ISOCHK,
  KLIB_HANDLE_TYPE_COUNT
}
 Handle type enumeration. More...
 
enum  KLST_SYNC_FLAG {
  KLST_SYNC_FLAG_NONE = 0L,
  KLST_SYNC_FLAG_UNCHANGED = 0x0001,
  KLST_SYNC_FLAG_ADDED = 0x0002,
  KLST_SYNC_FLAG_REMOVED = 0x0004,
  KLST_SYNC_FLAG_CONNECT_CHANGE = 0x0008,
  KLST_SYNC_FLAG_MASK = 0x000F
}
 Device list sync flags. More...
 
enum  KLST_FLAG {
  KLST_FLAG_NONE = 0L,
  KLST_FLAG_INCLUDE_RAWGUID = 0x0001,
  KLST_FLAG_INCLUDE_DISCONNECT = 0x0002
}
 Device list initialization flags. More...
 
enum  BMREQUEST_DIR
 bmRequest.Dir
 
enum  BMREQUEST_TYPE {
  BMREQUEST_TYPE_STANDARD = 0,
  BMREQUEST_TYPE_CLASS = 1,
  BMREQUEST_TYPE_VENDOR = 2
}
 bmRequest.Type More...
 
enum  BMREQUEST_RECIPIENT {
  BMREQUEST_RECIPIENT_DEVICE = 0,
  BMREQUEST_RECIPIENT_INTERFACE = 1,
  BMREQUEST_RECIPIENT_ENDPOINT = 2,
  BMREQUEST_RECIPIENT_OTHER = 3
}
 bmRequest.Recipient More...
 
enum  USB_GETSTATUS {
  USB_GETSTATUS_SELF_POWERED = 0x01,
  USB_GETSTATUS_REMOTE_WAKEUP_ENABLED = 0x02
}
 Values for the bits returned by the USB_REQUEST_GET_STATUS request. More...
 
enum  USB_DESCRIPTOR_TYPE {
  USB_DESCRIPTOR_TYPE_DEVICE = 0x01,
  USB_DESCRIPTOR_TYPE_CONFIGURATION = 0x02,
  USB_DESCRIPTOR_TYPE_STRING = 0x03,
  USB_DESCRIPTOR_TYPE_INTERFACE = 0x04,
  USB_DESCRIPTOR_TYPE_ENDPOINT = 0x05,
  USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER = 0x06,
  USB_DESCRIPTOR_TYPE_CONFIG_POWER = 0x07,
  USB_DESCRIPTOR_TYPE_INTERFACE_POWER = 0x08,
  USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION = 0x0B,
  USB_DESCRIPTOR_TYPE_BOS = 0x0F,
  USB_DESCRIPTOR_TYPE_DEVICE_CAPS = 0x10,
  USB_SUPERSPEED_ENDPOINT_COMPANION = 0x30
}
 Standard USB descriptor types. For more information, see section 9-5 of the USB 3.0 specifications. More...
 
enum  USB_CONFIG_BM_ATTRIBUTE_ENUM {
  USB_CONFIG_BUS_POWERED = 0x80,
  USB_CONFIG_SELF_POWERED = 0x40,
  USB_CONFIG_REMOTE_WAKEUP = 0x20
}
 Values used in the bmAttributes field of a USB_CONFIGURATION_DESCRIPTOR. More...
 
enum  USB_REQUEST_ENUM {
  USB_REQUEST_GET_STATUS = 0x00,
  USB_REQUEST_CLEAR_FEATURE = 0x01,
  USB_REQUEST_SET_FEATURE = 0x03,
  USB_REQUEST_SET_ADDRESS = 0x05,
  USB_REQUEST_GET_DESCRIPTOR = 0x06,
  USB_REQUEST_SET_DESCRIPTOR = 0x07,
  USB_REQUEST_GET_CONFIGURATION = 0x08,
  USB_REQUEST_SET_CONFIGURATION = 0x09,
  USB_REQUEST_GET_INTERFACE = 0x0A,
  USB_REQUEST_SET_INTERFACE = 0x0B,
  USB_REQUEST_SYNC_FRAME = 0x0C
}
 USB defined request codes. More...
 
enum  USB_DEVICE_CLASS_ENUM {
  USB_DEVICE_CLASS_RESERVED = 0x00,
  USB_DEVICE_CLASS_AUDIO = 0x01,
  USB_DEVICE_CLASS_COMMUNICATIONS = 0x02,
  USB_DEVICE_CLASS_HUMAN_INTERFACE = 0x03,
  USB_DEVICE_CLASS_IMAGING = 0x06,
  USB_DEVICE_CLASS_PRINTER = 0x07,
  USB_DEVICE_CLASS_STORAGE = 0x08,
  USB_DEVICE_CLASS_HUB = 0x09,
  USB_DEVICE_CLASS_VENDOR_SPECIFIC = 0xFF
}
 USB defined class codes. More...
 
enum  BOS_CAPABILITY_TYPE {
  BOS_CAPABILITY_TYPE_WIRELESS_USB_DEVICE_CAPABILITY = 0x01,
  BOS_CAPABILITY_TYPE_USB_2_0_EXTENSION = 0x02,
  BOS_CAPABILITY_TYPE_SS_USB_DEVICE_CAPABILITY = 0x03,
  BOS_CAPABILITY_TYPE_CONTAINER_ID = 0x04,
  BOS_CAPABILITY_TYPE_PLATFORM = 0x05,
  BOS_POWER_DELIVERY_CAPABILITY = 0x06,
  BOS_BATTERY_INFO_CAPABILITY = 0x07,
  BOS_PD_CONSUMER_PORT_CAPABILITY = 0x08,
  BOS_PD_PROVIDER_PORT_CAPABILITY = 0x09,
  BOS_SUPERSPEED_PLUS = 0x0A,
  BOS_PRECISION_TIME_MEASUREMENT = 0x0B,
  BOS_WIRELESS_USB_EXT = 0x0C,
  BOS_BILLBOARD = 0x0D,
  BOS_AUTHENTICATION = 0x0E,
  BOS_BILLBOARD_EX = 0x0F,
  BOS_CONFIGURATION_SUMMARY = 0x10
}
 USB BOS capability types. More...
 
enum  MSOS_FEATURE_TYPE {
  MSOS_FEATURE_TYPE_V1_EXTENDED_COMPAT_ID = 0x0004,
  MSOS_FEATURE_TYPE_V1_EXTENDED_PROPS = 0x0005,
  MSOS_FEATURE_TYPE_V2_DESCRIPTOR_SET = 0x0007
}
 Microsoft feature descriptor types. More...
 
enum  MSOSV2_DESCRIPTOR_TYPE {
  MSOSV2_DESCRIPTOR_TYPE_SET_HEADER_DESCRIPTOR = 0x00,
  MSOSV2_DESCRIPTOR_TYPE_SUBSET_HEADER_CONFIGURATION = 0x01,
  MSOSV2_DESCRIPTOR_TYPE_SUBSET_HEADER_FUNCTION = 0x02,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_COMPATIBLE_ID = 0x03,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_REG_PROPERTY = 0x04,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_MIN_RESUME_TIME = 0x05,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_MODEL_ID = 0x06,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_CCGP_DEVICE = 0x07,
  MSOSV2_DESCRIPTOR_TYPE_FEATURE_VENDOR_REVISION = 0x08
}
 Microsoft OS 2.0 descriptor wDescriptorType values. More...
 
enum  KUSB_PROPERTY { KUSB_PROPERTY_DEVICE_FILE_HANDLE }
 Usb handle specific properties that can be retrieved with UsbK_GetProperty. More...
 
enum  KUSB_DRVID {
  KUSB_DRVID_LIBUSBK,
  KUSB_DRVID_LIBUSB0,
  KUSB_DRVID_WINUSB,
  KUSB_DRVID_LIBUSB0_FILTER,
  KUSB_DRVID_COUNT
}
 Supported driver id enumeration. More...
 
enum  KUSB_FNID {
  KUSB_FNID_Init,
  KUSB_FNID_Free,
  KUSB_FNID_ClaimInterface,
  KUSB_FNID_ReleaseInterface,
  KUSB_FNID_SetAltInterface,
  KUSB_FNID_GetAltInterface,
  KUSB_FNID_GetDescriptor,
  KUSB_FNID_ControlTransfer,
  KUSB_FNID_SetPowerPolicy,
  KUSB_FNID_GetPowerPolicy,
  KUSB_FNID_SetConfiguration,
  KUSB_FNID_GetConfiguration,
  KUSB_FNID_ResetDevice,
  KUSB_FNID_Initialize,
  KUSB_FNID_SelectInterface,
  KUSB_FNID_GetAssociatedInterface,
  KUSB_FNID_Clone,
  KUSB_FNID_QueryInterfaceSettings,
  KUSB_FNID_QueryDeviceInformation,
  KUSB_FNID_SetCurrentAlternateSetting,
  KUSB_FNID_GetCurrentAlternateSetting,
  KUSB_FNID_QueryPipe,
  KUSB_FNID_SetPipePolicy,
  KUSB_FNID_GetPipePolicy,
  KUSB_FNID_ReadPipe,
  KUSB_FNID_WritePipe,
  KUSB_FNID_ResetPipe,
  KUSB_FNID_AbortPipe,
  KUSB_FNID_FlushPipe,
  KUSB_FNID_IsoReadPipe,
  KUSB_FNID_IsoWritePipe,
  KUSB_FNID_GetCurrentFrameNumber,
  KUSB_FNID_GetOverlappedResult,
  KUSB_FNID_GetProperty,
  KUSB_FNID_IsochReadPipe,
  KUSB_FNID_IsochWritePipe,
  KUSB_FNID_QueryPipeEx,
  KUSB_FNID_GetSuperSpeedPipeCompanionDescriptor,
  KUSB_FNID_COUNT
}
 Supported function id enumeration. More...
 
enum  KHOT_FLAG {
  KHOT_FLAG_NONE,
  KHOT_FLAG_PLUG_ALL_ON_INIT = 0x0001,
  KHOT_FLAG_PASS_DUPE_INSTANCE = 0x0002,
  KHOT_FLAG_POST_USER_MESSAGE = 0x0004
}
 Hot plug config flags. More...
 
enum  KOVL_WAIT_FLAG {
  KOVL_WAIT_FLAG_NONE = 0L,
  KOVL_WAIT_FLAG_RELEASE_ON_SUCCESS = 0x0001,
  KOVL_WAIT_FLAG_RELEASE_ON_FAIL = 0x0002,
  KOVL_WAIT_FLAG_RELEASE_ON_SUCCESS_FAIL = 0x0003,
  KOVL_WAIT_FLAG_CANCEL_ON_TIMEOUT = 0x0004,
  KOVL_WAIT_FLAG_RELEASE_ON_TIMEOUT = 0x000C,
  KOVL_WAIT_FLAG_RELEASE_ALWAYS = 0x000F,
  KOVL_WAIT_FLAG_ALERTABLE = 0x0010
}
 WaitFlags used by OvlK_Wait. More...
 
enum  KOVL_POOL_FLAG
 Overlapped pool config flags. More...
 
enum  KSTM_FLAG { KSTM_FLAG_NONE = 0L }
 Stream config flags. More...
 
enum  KSTM_COMPLETE_RESULT {
  KSTM_COMPLETE_RESULT_VALID = 0L,
  KSTM_COMPLETE_RESULT_INVALID
}
 Stream config flags. More...
 

Functions

typedef INT_PTR (FAR WINAPI *KPROC)()
 UsbK base function pointer, See LibK_GetProcAddress.
 
KUSB_EXP VOID KUSB_API LibK_GetVersion (_out PKLIB_VERSION Version)
 Gets the internal user context for the specified KLIB_HANDLE. More...
 
KUSB_EXP KLIB_USER_CONTEXT KUSB_API LibK_GetContext (_in KLIB_HANDLE Handle, _in KLIB_HANDLE_TYPE HandleType)
 Gets the internal user context for the specified KLIB_HANDLE. More...
 
KUSB_EXP BOOL KUSB_API LibK_SetContext (_in KLIB_HANDLE Handle, _in KLIB_HANDLE_TYPE HandleType, _in KLIB_USER_CONTEXT ContextValue)
 Sets internal user context for the specified KLIB_HANDLE. More...
 
KUSB_EXP BOOL KUSB_API LibK_SetCleanupCallback (_in KLIB_HANDLE Handle, _in KLIB_HANDLE_TYPE HandleType, _in KLIB_HANDLE_CLEANUP_CB *CleanupCB)
 Assigns a cleanup callback function to a KLIB_HANDLE. More...
 
KUSB_EXP BOOL KUSB_API LibK_LoadDriverAPI (_out PKUSB_DRIVER_API DriverAPI, _in INT DriverID)
 Initialize a driver API set. More...
 
KUSB_EXP BOOL KUSB_API LibK_IsFunctionSupported (_in PKUSB_DRIVER_API DriverAPI, _in UINT FunctionID)
 Checks if the driver supports a function. More...
 
KUSB_EXP BOOL KUSB_API LibK_CopyDriverAPI (_out PKUSB_DRIVER_API DriverAPI, _in KUSB_HANDLE UsbHandle)
 Copies the driver API set out of a KUSB_HANDLE. More...
 
KUSB_EXP BOOL KUSB_API LibK_GetProcAddress (_out KPROC *ProcAddress, _in INT DriverID, _in INT FunctionID)
 Initialize a driver API function. More...
 
KUSB_EXP BOOL KUSB_API LibK_SetDefaultContext (_in KLIB_HANDLE_TYPE HandleType, _in KLIB_USER_CONTEXT ContextValue)
 Sets the default user context for the specified KLIB_HANDLE_TYPE. More...
 
KUSB_EXP KLIB_USER_CONTEXT KUSB_API LibK_GetDefaultContext (_in KLIB_HANDLE_TYPE HandleType)
 Gets the default user context for the specified KLIB_HANDLE_TYPE. More...
 
KUSB_EXP BOOL KUSB_API LibK_Context_Init (_inopt HANDLE Heap, _in PVOID Reserved)
 Initializes the global libusbK process context. More...
 
KUSB_EXP VOID KUSB_API LibK_Context_Free (VOID)
 Frees the global libusbK process context. More...
 
KUSB_EXP BOOL KUSB_API UsbK_Init (_out KUSB_HANDLE *InterfaceHandle, _in KLST_DEVINFO_HANDLE DevInfo)
 Creates/opens a libusbK interface handle from the device list. This is a preferred method. More...
 
KUSB_EXP BOOL KUSB_API UsbK_Free (_in KUSB_HANDLE InterfaceHandle)
 Frees a libusbK interface handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_ClaimInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR NumberOrIndex, _in BOOL IsIndex)
 Claims the specified interface by number or index. More...
 
KUSB_EXP BOOL KUSB_API UsbK_ReleaseInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR NumberOrIndex, _in BOOL IsIndex)
 Releases the specified interface by number or index. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SetAltInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR NumberOrIndex, _in BOOL IsIndex, _in UCHAR AltSettingNumber)
 Sets the alternate setting of the specified interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetAltInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR NumberOrIndex, _in BOOL IsIndex, _out PUCHAR AltSettingNumber)
 Gets the alternate setting for the specified interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetDescriptor (_in KUSB_HANDLE InterfaceHandle, _in UCHAR DescriptorType, _in UCHAR Index, _in USHORT LanguageID, _out PUCHAR Buffer, _in UINT BufferLength, _outopt PUINT LengthTransferred)
 Gets the requested descriptor. This is a synchronous operation. More...
 
KUSB_EXP BOOL KUSB_API UsbK_ControlTransfer (_in KUSB_HANDLE InterfaceHandle, _in WINUSB_SETUP_PACKET SetupPacket, _refopt PUCHAR Buffer, _in UINT BufferLength, _outopt PUINT LengthTransferred, _inopt LPOVERLAPPED Overlapped)
 Transmits control data over a default control endpoint. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SetPowerPolicy (_in KUSB_HANDLE InterfaceHandle, _in UINT PolicyType, _in UINT ValueLength, _in PVOID Value)
 Sets the power policy for a device. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetPowerPolicy (_in KUSB_HANDLE InterfaceHandle, _in UINT PolicyType, _ref PUINT ValueLength, _out PVOID Value)
 Gets the power policy for a device. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SetConfiguration (_in KUSB_HANDLE InterfaceHandle, _in UCHAR ConfigurationNumber)
 Sets the device configuration number. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetConfiguration (_in KUSB_HANDLE InterfaceHandle, _out PUCHAR ConfigurationNumber)
 Gets the device current configuration number. More...
 
KUSB_EXP BOOL KUSB_API UsbK_ResetDevice (_in KUSB_HANDLE InterfaceHandle)
 Resets the usb device of the specified interface handle. (port cycle). More...
 
KUSB_EXP BOOL KUSB_API UsbK_Initialize (_in HANDLE DeviceHandle, _out KUSB_HANDLE *InterfaceHandle)
 Creates a libusbK handle for the device specified by a file handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SelectInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR NumberOrIndex, _in BOOL IsIndex)
 Selects the specified interface by number or index as the current interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetAssociatedInterface (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AssociatedInterfaceIndex, _out KUSB_HANDLE *AssociatedInterfaceHandle)
 Retrieves a handle for an associated interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_Clone (_in KUSB_HANDLE InterfaceHandle, _out KUSB_HANDLE *DstInterfaceHandle)
 Clones the specified interface handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_QueryInterfaceSettings (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AltSettingIndex, _out PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor)
 Retrieves the interface descriptor for the specified alternate interface settings for a particular interface handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_QueryDeviceInformation (_in KUSB_HANDLE InterfaceHandle, _in UINT InformationType, _ref PUINT BufferLength, _ref PUCHAR Buffer)
 Retrieves information about the physical device that is associated with a libusbK handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SetCurrentAlternateSetting (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AltSettingNumber)
 Sets the alternate setting of an interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetCurrentAlternateSetting (_in KUSB_HANDLE InterfaceHandle, _out PUCHAR AltSettingNumber)
 Gets the current alternate interface setting for an interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_QueryPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AltSettingNumber, _in UCHAR PipeIndex, _out PWINUSB_PIPE_INFORMATION PipeInformation)
 Retrieves information about a pipe that is associated with an interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_QueryPipeEx (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AltSettingNumber, _in UCHAR PipeIndex, _out PWINUSB_PIPE_INFORMATION_EX PipeInformationEx)
 Retrieves information about a pipe that is associated with an interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetSuperSpeedPipeCompanionDescriptor (_in KUSB_HANDLE InterfaceHandle, _in UCHAR AltSettingNumber, _in UCHAR PipeIndex, _out PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR PipeCompanionDescriptor)
 Retrieves a pipes super speed endpoint companion descriptor associated with an interface. More...
 
KUSB_EXP BOOL KUSB_API UsbK_SetPipePolicy (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _in UINT PolicyType, _in UINT ValueLength, _in PVOID Value)
 Sets the policy for a specific pipe associated with an endpoint on the device. This is a synchronous operation. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetPipePolicy (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _in UINT PolicyType, _ref PUINT ValueLength, _out PVOID Value)
 Gets the policy for a specific pipe (endpoint). More...
 
KUSB_EXP BOOL KUSB_API UsbK_ReadPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _out PUCHAR Buffer, _in UINT BufferLength, _outopt PUINT LengthTransferred, _inopt LPOVERLAPPED Overlapped)
 Reads data from the specified pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_WritePipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _in PUCHAR Buffer, _in UINT BufferLength, _outopt PUINT LengthTransferred, _inopt LPOVERLAPPED Overlapped)
 Writes data to a pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_ResetPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID)
 Resets the data toggle and clears the stall condition on a pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_AbortPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID)
 Aborts all of the pending transfers for a pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_FlushPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID)
 Discards any data that is cached in a pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_IsoReadPipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _out PUCHAR Buffer, _in UINT BufferLength, _in LPOVERLAPPED Overlapped, _refopt PKISO_CONTEXT IsoContext)
 Reads from an isochronous pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_IsoWritePipe (_in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeID, _in PUCHAR Buffer, _in UINT BufferLength, _in LPOVERLAPPED Overlapped, _refopt PKISO_CONTEXT IsoContext)
 Writes to an isochronous pipe. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetCurrentFrameNumber (_in KUSB_HANDLE InterfaceHandle, _out PUINT FrameNumber)
 Retrieves the current USB frame number. More...
 
KUSB_EXP BOOL KUSB_API UsbK_IsochReadPipe (_in KISOCH_HANDLE IsochHandle, _inopt UINT DataLength, _refopt PUINT FrameNumber, _inopt UINT NumberOfPackets, _in LPOVERLAPPED Overlapped)
 Reads from an isochronous pipe. Supports LibusbK or WinUsb. More...
 
KUSB_EXP BOOL KUSB_API UsbK_IsochWritePipe (_in KISOCH_HANDLE IsochHandle, _inopt UINT DataLength, _ref PUINT FrameNumber, _inopt UINT NumberOfPackets, _in LPOVERLAPPED Overlapped)
 Writes to an isochronous pipe. Supports LibusbK or WinUsb. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetOverlappedResult (_in KUSB_HANDLE InterfaceHandle, _in LPOVERLAPPED Overlapped, _out PUINT lpNumberOfBytesTransferred, _in BOOL bWait)
 Retrieves the results of an overlapped operation on the specified libusbK handle. More...
 
KUSB_EXP BOOL KUSB_API UsbK_GetProperty (_in KUSB_HANDLE InterfaceHandle, _in KUSB_PROPERTY PropertyType, _ref PUINT PropertySize, _out PVOID Value)
 Gets a USB device (driver specific) property from usb handle. More...
 
KUSB_EXP BOOL KUSB_API LstK_Init (_out KLST_HANDLE *DeviceList, _in KLST_FLAG Flags)
 Initializes a new usb device list containing all supported devices. More...
 
KUSB_EXP BOOL KUSB_API LstK_InitEx (_out KLST_HANDLE *DeviceList, _in KLST_FLAG Flags, _in PKLST_PATTERN_MATCH PatternMatch)
 Initializes a new usb device list containing only devices matching a specific class GUID. More...
 
KUSB_EXP BOOL KUSB_API LstK_Free (_in KLST_HANDLE DeviceList)
 Frees a usb device list. More...
 
KUSB_EXP BOOL KUSB_API LstK_Enumerate (_in KLST_HANDLE DeviceList, _in KLST_ENUM_DEVINFO_CB *EnumDevListCB, _inopt PVOID Context)
 Enumerates KLST_DEVINFO elements of a KLST_HANDLE. More...
 
KUSB_EXP BOOL KUSB_API LstK_Current (_in KLST_HANDLE DeviceList, _out KLST_DEVINFO_HANDLE *DeviceInfo)
 Gets the KLST_DEVINFO element for the current position. More...
 
KUSB_EXP BOOL KUSB_API LstK_MoveNext (_in KLST_HANDLE DeviceList, _outopt KLST_DEVINFO_HANDLE *DeviceInfo)
 Advances the device list current KLST_DEVINFO position. More...
 
KUSB_EXP VOID KUSB_API LstK_MoveReset (_in KLST_HANDLE DeviceList)
 Sets the device list to its initial position, which is before the first element in the list. More...
 
KUSB_EXP BOOL KUSB_API LstK_FindByVidPid (_in KLST_HANDLE DeviceList, _in INT Vid, _in INT Pid, _out KLST_DEVINFO_HANDLE *DeviceInfo)
 Find a device by vendor and product id. More...
 
KUSB_EXP BOOL KUSB_API LstK_Count (_in KLST_HANDLE DeviceList, _ref PUINT Count)
 Counts the number of device info elements in a device list. More...
 
KUSB_EXP BOOL KUSB_API HotK_Init (_out KHOT_HANDLE *Handle, _ref PKHOT_PARAMS InitParams)
 Creates a new hot-plug handle for USB device arrival/removal event monitoring. More...
 
KUSB_EXP BOOL KUSB_API HotK_Free (_in KHOT_HANDLE Handle)
 Frees the specified hot-plug handle. More...
 
KUSB_EXP VOID KUSB_API HotK_FreeAll (VOID)
 Frees all hot-plug handles initialized with HotK_Init.
 
KUSB_EXP BOOL KUSB_API OvlK_Acquire (_out KOVL_HANDLE *OverlappedK, _in KOVL_POOL_HANDLE PoolHandle)
 Gets a preallocated OverlappedK structure from the specified/default pool. More...
 
KUSB_EXP BOOL KUSB_API OvlK_Release (_in KOVL_HANDLE OverlappedK)
 Returns an OverlappedK structure to it's pool. More...
 
KUSB_EXP BOOL KUSB_API OvlK_Init (_out KOVL_POOL_HANDLE *PoolHandle, _in KUSB_HANDLE UsbHandle, _in INT MaxOverlappedCount, _inopt KOVL_POOL_FLAG Flags)
 Creates a new overlapped pool. More...
 
KUSB_EXP BOOL KUSB_API OvlK_Free (_in KOVL_POOL_HANDLE PoolHandle)
 Destroys the specified pool and all resources it created. More...
 
KUSB_EXP HANDLE KUSB_API OvlK_GetEventHandle (_in KOVL_HANDLE OverlappedK)
 Returns the internal event handle used to signal IO operations. More...
 
KUSB_EXP BOOL KUSB_API OvlK_Wait (_in KOVL_HANDLE OverlappedK, _inopt INT TimeoutMS, _inopt KOVL_WAIT_FLAG WaitFlags, _out PUINT TransferredLength)
 Waits for overlapped I/O completion, and performs actions specified in WaitFlags. More...
 
KUSB_EXP BOOL KUSB_API OvlK_WaitOldest (_in KOVL_POOL_HANDLE PoolHandle, _outopt KOVL_HANDLE *OverlappedK, _inopt INT TimeoutMS, _inopt KOVL_WAIT_FLAG WaitFlags, _out PUINT TransferredLength)
 Waits for overlapped I/O completion on the oldest acquired OverlappedK handle and performs actions specified in WaitFlags. More...
 
KUSB_EXP BOOL KUSB_API OvlK_WaitOrCancel (_in KOVL_HANDLE OverlappedK, _inopt INT TimeoutMS, _out PUINT TransferredLength)
 Waits for overlapped I/O completion, cancels on a timeout error. More...
 
KUSB_EXP BOOL KUSB_API OvlK_WaitAndRelease (_in KOVL_HANDLE OverlappedK, _inopt INT TimeoutMS, _out PUINT TransferredLength)
 Waits for overlapped I/O completion, cancels on a timeout error and always releases the OvlK handle back to its pool. More...
 
KUSB_EXP BOOL KUSB_API OvlK_IsComplete (_in KOVL_HANDLE OverlappedK)
 Checks for i/o completion; returns immediately. (polling) More...
 
KUSB_EXP BOOL KUSB_API OvlK_ReUse (_in KOVL_HANDLE OverlappedK)
 Initializes an overlappedK for re-use. The overlappedK is not return to its pool. More...
 
KUSB_EXP BOOL KUSB_API StmK_Init (_out KSTM_HANDLE *StreamHandle, _in KUSB_HANDLE UsbHandle, _in UCHAR PipeID, _in INT MaxTransferSize, _in INT MaxPendingTransfers, _in INT MaxPendingIO, _inopt PKSTM_CALLBACK Callbacks, _inopt KSTM_FLAG Flags)
 Initializes a new uni-directional pipe stream. More...
 
KUSB_EXP BOOL KUSB_API StmK_Free (_in KSTM_HANDLE StreamHandle)
 Frees resources allocated by a stream handle. More...
 
KUSB_EXP BOOL KUSB_API StmK_Start (_in KSTM_HANDLE StreamHandle)
 Starts the internal stream thread. More...
 
KUSB_EXP BOOL KUSB_API StmK_Stop (_in KSTM_HANDLE StreamHandle, _in INT TimeoutCancelMS)
 Stops the internal stream thread. More...
 
KUSB_EXP BOOL KUSB_API StmK_Read (_in KSTM_HANDLE StreamHandle, _out PUCHAR Buffer, _in INT Offset, _in INT Length, _out PUINT TransferredLength)
 Reads data from the stream buffer. More...
 
KUSB_EXP BOOL KUSB_API StmK_Write (_in KSTM_HANDLE StreamHandle, _in PUCHAR Buffer, _in INT Offset, _in INT Length, _out PUINT TransferredLength)
 Writes data to the stream buffer. More...
 
KUSB_EXP BOOL KUSB_API IsoK_Init (_out PKISO_CONTEXT *IsoContext, _in INT NumberOfPackets, _inopt INT StartFrame)
 Creates a new isochronous transfer context for libusbK only. More...
 
KUSB_EXP BOOL KUSB_API IsoK_Free (_in PKISO_CONTEXT IsoContext)
 Destroys an isochronous transfer context. More...
 
KUSB_EXP BOOL KUSB_API IsoK_SetPackets (_in PKISO_CONTEXT IsoContext, _in INT PacketSize)
 Convenience function for setting the offset of all ISO packets of an isochronous transfer context. More...
 
KUSB_EXP BOOL KUSB_API IsoK_SetPacket (_in PKISO_CONTEXT IsoContext, _in INT PacketIndex, _in PKISO_PACKET IsoPacket)
 Convenience function for setting all fields of a KISO_PACKET. More...
 
KUSB_EXP BOOL KUSB_API IsoK_GetPacket (_in PKISO_CONTEXT IsoContext, _in INT PacketIndex, _out PKISO_PACKET IsoPacket)
 Convenience function for getting all fields of a KISO_PACKET. More...
 
KUSB_EXP BOOL KUSB_API IsoK_EnumPackets (_in PKISO_CONTEXT IsoContext, _in KISO_ENUM_PACKETS_CB *EnumPackets, _inopt INT StartPacketIndex, _inopt PVOID UserState)
 Convenience function for enumerating ISO packets of an isochronous transfer context. More...
 
KUSB_EXP BOOL KUSB_API IsoK_ReUse (_ref PKISO_CONTEXT IsoContext)
 Convenience function for re-using an isochronous transfer context in a subsequent request. More...
 
KUSB_EXP BOOL KUSB_API IsochK_Init (_out KISOCH_HANDLE *IsochHandle, _in KUSB_HANDLE InterfaceHandle, _in UCHAR PipeId, _in UINT MaxNumberOfPackets, _in PUCHAR TransferBuffer, _in UINT TransferBufferSize)
 Creates a new isochronous transfer handle for libusbK or WinUSB. More...
 
KUSB_EXP BOOL KUSB_API IsochK_Free (_in KISOCH_HANDLE IsochHandle)
 Destroys an isochronous transfer handle. More...
 
KUSB_EXP BOOL KUSB_API IsochK_SetPacketOffsets (_in KISOCH_HANDLE IsochHandle, _in UINT PacketSize)
 Convenience function for setting the offsets and lengths of all ISO packets of an isochronous transfer handle. More...
 
KUSB_EXP BOOL KUSB_API IsochK_SetPacket (_in KISOCH_HANDLE IsochHandle, _in UINT PacketIndex, _in UINT Offset, _in UINT Length, _in UINT Status)
 Convenience function for setting all fields in an isochronous transfer packet. More...
 
KUSB_EXP BOOL KUSB_API IsochK_GetPacket (_in KISOCH_HANDLE IsochHandle, _in UINT PacketIndex, _outopt PUINT Offset, _outopt PUINT Length, _outopt PUINT Status)
 Convenience function for getting all fields in an isochronous transfer packet. More...
 
KUSB_EXP BOOL KUSB_API IsochK_EnumPackets (_in KISOCH_HANDLE IsochHandle, _in KISOCH_ENUM_PACKETS_CB *EnumPackets, _inopt UINT StartPacketIndex, _inopt PVOID UserState)
 Convenience function for enumerating ISO packets of an isochronous transfer context. More...
 
KUSB_EXP BOOL KUSB_API IsochK_CalcPacketInformation (_in BOOL IsHighSpeed, _in PWINUSB_PIPE_INFORMATION_EX PipeInformationEx, _out PKISOCH_PACKET_INFORMATION PacketInformation)
 Helper function for isochronous packet/transfer calculations. More...
 
KUSB_EXP BOOL KUSB_API IsochK_GetNumberOfPackets (_in KISOCH_HANDLE IsochHandle, _out PUINT NumberOfPackets)
 Gets the number of iso packets that will be used. More...
 
KUSB_EXP BOOL KUSB_API IsochK_SetNumberOfPackets (_in KISOCH_HANDLE IsochHandle, _in UINT NumberOfPackets)
 Sets the number of iso packets that will be used. More...
 
KUSB_EXP BOOL KUSB_API LUsb0_ControlTransfer (_in KUSB_HANDLE InterfaceHandle, _in WINUSB_SETUP_PACKET SetupPacket, _refopt PUCHAR Buffer, _in UINT BufferLength, _outopt PUINT LengthTransferred, _inopt LPOVERLAPPED Overlapped)
 Transmits control data over a default control endpoint. More...
 
KUSB_EXP BOOL KUSB_API LUsb0_SetConfiguration (_in KUSB_HANDLE InterfaceHandle, _in UCHAR ConfigurationNumber)
 Sets the device configuration number. More...
 

Detailed Description

functions for usb device communication.

Note
This is the main libusbK USB user include file.

Function Documentation

KUSB_EXP BOOL KUSB_API LUsb0_ControlTransfer ( _in KUSB_HANDLE  InterfaceHandle,
_in WINUSB_SETUP_PACKET  SetupPacket,
_refopt PUCHAR  Buffer,
_in UINT  BufferLength,
_outopt PUINT  LengthTransferred,
_inopt LPOVERLAPPED  Overlapped 
)

Transmits control data over a default control endpoint.

Parameters
[in]InterfaceHandleA valid libusbK interface handle returned by:
[in]SetupPacketThe 8-byte setup packet of type WINUSB_SETUP_PACKET.
[in,out]BufferA caller-allocated buffer that contains the data to transfer.
[in]BufferLengthThe number of bytes to transfer, not including the setup packet. This number must be less than or equal to the size, in bytes, of Buffer.
[out]LengthTransferredA pointer to a UINT variable that receives the actual number of transferred bytes. If the application does not expect any data to be transferred during the data phase (BufferLength is zero), LengthTransferred can be NULL.
[in]OverlappedAn optional pointer to an OVERLAPPED structure, which is used for asynchronous operations. If this parameter is specified, UsbK_ControlTransfer immediately returns, and the event is signaled when the operation is complete. If Overlapped is not supplied, the UsbK_ControlTransfer function transfers data synchronously.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information. If an Overlapped member is supplied and the operation succeeds this function returns FALSE and sets last error to ERROR_IO_PENDING.

A UsbK_ControlTransfer is never cached. These requests always go directly to the usb device.

Attention
This function should not be used for operations supported by the library.
e.g. LUsb0_SetConfiguration, UsbK_SetAltInterface, etc..
KUSB_EXP BOOL KUSB_API LUsb0_SetConfiguration ( _in KUSB_HANDLE  InterfaceHandle,
_in UCHAR  ConfigurationNumber 
)

Sets the device configuration number.

Parameters
[in]InterfaceHandleAn initialized usb handle, see UsbK_Init.
[in]ConfigurationNumberThe configuration number to activate.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.

LUsb0_SetConfiguration is only supported with libusb0.sys. If the driver in not libusb0.sys, this function performs the following emulation actions:

  • If the requested configuration number is the current configuration number, returns TRUE.
  • If the requested configuration number is one other than the current configuration number, returns FALSE and set last error to ERROR_NO_MORE_ITEMS.

This function will fail if there are pending I/O operations or there are other libusbK interface handles referencing the device.

See Also
UsbK_Free