libusbK 
3.0
Library Documentation
© 2011-2021 Travis Lee Robinson. All rights reserved.
USB General

General libusbK library functions, defines, and structures. More...

Data Structures

union  KUSB_SETUP_PACKET
 KUSB control setup packet. More...
 
struct  KLIB_VERSION
 libusbK verson information 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  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...
 

Modules

 USB BOS Descriptors
 Descriptor structures and enums for working with USB BOS Descriptors.
 
 Microsoft OS V1.0 Descriptors
 Descriptor structures and enums for working with Microsoft OS V1.0 Descriptors.
 
 Microsoft OS V2.0 Descriptors
 Descriptor structures and enums for working with Microsoft OS V2.0 Descriptors.
 

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 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 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
 

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  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  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...
 

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...
 

Detailed Description

General libusbK library functions, defines, and structures.

Macro Definition Documentation

#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)

Parameters
addrbEndpointAddress field of a USB_ENDPOINT_DESCRIPTOR
#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)

Parameters
addrbEndpointAddress field of a USB_ENDPOINT_DESCRIPTOR
Examples:
pipe-policy-timeout.c, xfer-async-loop.c, xfer-async.c, xfer-iso-asap.c, xfer-iso.c, xfer-stream.c, and xfer-sync.c.

Enumeration Type Documentation

Handle type enumeration.

Enumerator
KLIB_HANDLE_TYPE_HOTK 

Hot plug handle. KHOT_HANDLE.

KLIB_HANDLE_TYPE_USBK 

USB handle. KUSB_HANDLE.

KLIB_HANDLE_TYPE_USBSHAREDK 

Shared USB handle. KUSB_HANDLE.

KLIB_HANDLE_TYPE_LSTK 

Device list handle. KLST_HANDLE.

KLIB_HANDLE_TYPE_LSTINFOK 

Device info handle. KLST_DEVINFO_HANDLE.

KLIB_HANDLE_TYPE_OVLK 

Overlapped handle. KOVL_HANDLE.

KLIB_HANDLE_TYPE_OVLPOOLK 

Overlapped pool handle. KOVL_POOL_HANDLE.

KLIB_HANDLE_TYPE_STMK 

Pipe stream handle. KSTM_HANDLE.

KLIB_HANDLE_TYPE_ISOCHK 

Pipe stream handle. KSTM_HANDLE.

KLIB_HANDLE_TYPE_COUNT 

Max handle type count.

bmRequest.Type

Enumerator
BMREQUEST_TYPE_STANDARD 

Standard request. See USB_REQUEST_ENUM.

BMREQUEST_TYPE_CLASS 

Class-specific request.

BMREQUEST_TYPE_VENDOR 

Vendor-specific request.

bmRequest.Recipient

Enumerator
BMREQUEST_RECIPIENT_DEVICE 

Request is for a device.

BMREQUEST_RECIPIENT_INTERFACE 

Request is for an interface of a device.

BMREQUEST_RECIPIENT_ENDPOINT 

Request is for an endpoint of a device.

BMREQUEST_RECIPIENT_OTHER 

Request is for a vendor-specific purpose.

Values for the bits returned by the USB_REQUEST_GET_STATUS request.

Enumerator
USB_GETSTATUS_SELF_POWERED 

Device is self powered.

USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 

Device can wake the system from a low power/sleeping state.

Standard USB descriptor types. For more information, see section 9-5 of the USB 3.0 specifications.

Enumerator
USB_DESCRIPTOR_TYPE_DEVICE 

Device descriptor type.

USB_DESCRIPTOR_TYPE_CONFIGURATION 

Configuration descriptor type.

USB_DESCRIPTOR_TYPE_STRING 

String descriptor type.

USB_DESCRIPTOR_TYPE_INTERFACE 

Interface descriptor type.

USB_DESCRIPTOR_TYPE_ENDPOINT 

Endpoint descriptor type.

USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER 

Device qualifier descriptor type.

USB_DESCRIPTOR_TYPE_CONFIG_POWER 

Config power descriptor type.

USB_DESCRIPTOR_TYPE_INTERFACE_POWER 

Interface power descriptor type.

USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION 

Interface association descriptor type.

USB_DESCRIPTOR_TYPE_BOS 

BOS descriptor type.

USB_DESCRIPTOR_TYPE_DEVICE_CAPS 

Device capabilities descriptor type.

USB_SUPERSPEED_ENDPOINT_COMPANION 

Superspeed endpoint companion descriptor type.

Values used in the bmAttributes field of a USB_CONFIGURATION_DESCRIPTOR.

Enumerator
USB_CONFIG_BUS_POWERED 

The device is powered by it's host.

USB_CONFIG_SELF_POWERED 

The device has an external power source.

USB_CONFIG_REMOTE_WAKEUP 

The device is capable of waking the the host from a low power/sleeping state.

USB defined request codes.

Enumerator
USB_REQUEST_GET_STATUS 

Request status of the specific recipient.

USB_REQUEST_CLEAR_FEATURE 

Clear or disable a specific feature.

USB_REQUEST_SET_FEATURE 

Set or enable a specific feature.

USB_REQUEST_SET_ADDRESS 

Set device address for all future accesses.

USB_REQUEST_GET_DESCRIPTOR 

Get the specified descriptor.

USB_REQUEST_SET_DESCRIPTOR 

Update existing descriptors or add new descriptors.

USB_REQUEST_GET_CONFIGURATION 

Get the current device configuration value.

USB_REQUEST_SET_CONFIGURATION 

Set device configuration.

USB_REQUEST_GET_INTERFACE 

Return the selected alternate setting for the specified interface.

USB_REQUEST_SET_INTERFACE 

Select an alternate interface for the specified interface.

USB_REQUEST_SYNC_FRAME 

Set then report an endpoint's synchronization frame.

USB defined class codes.

see http://www.usb.org/developers/defined_class for more information.

Enumerator
USB_DEVICE_CLASS_RESERVED 

Reserved class.

USB_DEVICE_CLASS_AUDIO 

Audio class.

USB_DEVICE_CLASS_COMMUNICATIONS 

Communications class.

USB_DEVICE_CLASS_HUMAN_INTERFACE 

Human Interface Device class.

USB_DEVICE_CLASS_IMAGING 

Imaging class.

USB_DEVICE_CLASS_PRINTER 

Printer class.

USB_DEVICE_CLASS_STORAGE 

Mass storage class.

USB_DEVICE_CLASS_HUB 

Hub class.

USB_DEVICE_CLASS_VENDOR_SPECIFIC 

vendor-specific class

Usb handle specific properties that can be retrieved with UsbK_GetProperty.

Enumerator
KUSB_PROPERTY_DEVICE_FILE_HANDLE 

Get the internal device file handle used for operations such as GetOverlappedResult or DeviceIoControl.

enum KUSB_DRVID

Supported driver id enumeration.

Enumerator
KUSB_DRVID_LIBUSBK 

libusbK.sys driver ID

KUSB_DRVID_LIBUSB0 

libusb0.sys driver ID

KUSB_DRVID_WINUSB 

WinUSB.sys driver ID.

KUSB_DRVID_LIBUSB0_FILTER 

libusb0.sys filter driver ID

KUSB_DRVID_COUNT 

Supported driver count.

enum KUSB_FNID

Supported function id enumeration.

Enumerator
KUSB_FNID_Init 

UsbK_Init dynamic driver function id.

KUSB_FNID_Free 

UsbK_Free dynamic driver function id.

KUSB_FNID_ClaimInterface 

UsbK_ClaimInterface dynamic driver function id.

KUSB_FNID_ReleaseInterface 

UsbK_ReleaseInterface dynamic driver function id.

KUSB_FNID_SetAltInterface 

UsbK_SetAltInterface dynamic driver function id.

KUSB_FNID_GetAltInterface 

UsbK_GetAltInterface dynamic driver function id.

KUSB_FNID_GetDescriptor 

UsbK_GetDescriptor dynamic driver function id.

KUSB_FNID_ControlTransfer 

UsbK_ControlTransfer dynamic driver function id.

KUSB_FNID_SetPowerPolicy 

UsbK_SetPowerPolicy dynamic driver function id.

KUSB_FNID_GetPowerPolicy 

UsbK_GetPowerPolicy dynamic driver function id.

KUSB_FNID_SetConfiguration 

UsbK_SetConfiguration dynamic driver function id.

KUSB_FNID_GetConfiguration 

UsbK_GetConfiguration dynamic driver function id.

KUSB_FNID_ResetDevice 

UsbK_ResetDevice dynamic driver function id.

KUSB_FNID_Initialize 

UsbK_Initialize dynamic driver function id.

KUSB_FNID_SelectInterface 

UsbK_SelectInterface dynamic driver function id.

KUSB_FNID_GetAssociatedInterface 

UsbK_GetAssociatedInterface dynamic driver function id.

KUSB_FNID_Clone 

UsbK_Clone dynamic driver function id.

KUSB_FNID_QueryInterfaceSettings 

UsbK_QueryInterfaceSettings dynamic driver function id.

KUSB_FNID_QueryDeviceInformation 

UsbK_QueryDeviceInformation dynamic driver function id.

KUSB_FNID_SetCurrentAlternateSetting 

UsbK_SetCurrentAlternateSetting dynamic driver function id.

KUSB_FNID_GetCurrentAlternateSetting 

UsbK_GetCurrentAlternateSetting dynamic driver function id.

KUSB_FNID_QueryPipe 

UsbK_QueryPipe dynamic driver function id.

KUSB_FNID_SetPipePolicy 

UsbK_SetPipePolicy dynamic driver function id.

KUSB_FNID_GetPipePolicy 

UsbK_GetPipePolicy dynamic driver function id.

KUSB_FNID_ReadPipe 

UsbK_ReadPipe dynamic driver function id.

KUSB_FNID_WritePipe 

UsbK_WritePipe dynamic driver function id.

KUSB_FNID_ResetPipe 

UsbK_ResetPipe dynamic driver function id.

KUSB_FNID_AbortPipe 

UsbK_AbortPipe dynamic driver function id.

KUSB_FNID_FlushPipe 

UsbK_FlushPipe dynamic driver function id.

KUSB_FNID_IsoReadPipe 

UsbK_IsoReadPipe dynamic driver function id.

KUSB_FNID_IsoWritePipe 

UsbK_IsoWritePipe dynamic driver function id.

KUSB_FNID_GetCurrentFrameNumber 

UsbK_GetCurrentFrameNumber dynamic driver function id.

KUSB_FNID_GetOverlappedResult 

UsbK_GetOverlappedResult dynamic driver function id.

KUSB_FNID_GetProperty 

UsbK_GetProperty dynamic driver function id.

KUSB_FNID_IsochReadPipe 

UsbK_IsochReadPipe dynamic driver function id.

KUSB_FNID_IsochWritePipe 

UsbK_IsochWritePipe dynamic driver function id.

KUSB_FNID_QueryPipeEx 

UsbK_QueryPipeEx dynamic driver function id.

KUSB_FNID_GetSuperSpeedPipeCompanionDescriptor 

UsbK_GetSuperSpeedPipeCompanionDescriptor dynamic driver function id.

KUSB_FNID_COUNT 

Supported function count.

Function Documentation

KUSB_EXP VOID KUSB_API LibK_GetVersion ( _out PKLIB_VERSION  Version)

Gets the internal user context for the specified KLIB_HANDLE.

Parameters
[out]VersionReceives the libusbK library verson information.
Returns
NONE
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.

Parameters
[in]HandleThe handle containg the context to retrieve.
[in]HandleTypeHandle type of Handle.
Returns
  • on success, The user context value.
  • On failure, returns NULL and sets last error to ERROR_INVALID_HANDLE.
Examples:
show-device.c.
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.

Parameters
[in]HandleThe handle containg the context to set.
[in]HandleTypeHandle type of Handle.
[in]ContextValueValue to assign to the handle user context space.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
Examples:
show-device.c.
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.

Parameters
[in]HandleThe handle containg the cleanup callback function to set.
[in]HandleTypeHandle type of Handle.
[in]CleanupCBUser supplied callback function to execute when the handles internal reference count reaches 0.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
KUSB_EXP BOOL KUSB_API LibK_LoadDriverAPI ( _out PKUSB_DRIVER_API  DriverAPI,
_in INT  DriverID 
)

Initialize a driver API set.

Parameters
[out]DriverAPIA driver API structure to populate.
[in]DriverIDThe driver id of the API set to retrieve. See KUSB_DRVID
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
Examples:
config-interface.c, load-driver-api.c, open-device.c, pipe-policy-timeout.c, power-policy-suspend.c, xfer-async-loop.c, xfer-async.c, xfer-control.c, xfer-iso-asap.c, xfer-iso.c, xfer-stream.c, and xfer-sync.c.
KUSB_EXP BOOL KUSB_API LibK_IsFunctionSupported ( _in PKUSB_DRIVER_API  DriverAPI,
_in UINT  FunctionID 
)

Checks if the driver supports a function.

Parameters
[in]DriverAPIA driver API structure. See LibK_LoadDriverAPI
[in]FunctionIDThe function to check. See KUSB_FNID
Returns
TRUE if the specified function is supported. Otherwise FALSE.
Examples:
xfer-iso-asap.c, and xfer-iso.c.
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.

Parameters
[out]DriverAPIA driver API structure to populate.
[in]UsbHandleHandle containing the desired driver API.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
KUSB_EXP BOOL KUSB_API LibK_GetProcAddress ( _out KPROC *  ProcAddress,
_in INT  DriverID,
_in INT  FunctionID 
)

Initialize a driver API function.

Parameters
[out]ProcAddressReference to a function pointer that will receive the API function pointer.
[in]DriverIDThe driver id of the API to use. See KUSB_DRVID
[in]FunctionIDThe function id. See KUSB_FNID
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
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.

Parameters
[in]HandleTypeThe handle type which will be assigned the default ContextValue.
[in]ContextValueValue assigned to the default user context for the specified KLIB_HANDLE_TYPE.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
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.

Parameters
[in]HandleTypeHandle type used to retrieve the default user context.
Returns
  • on success, The default user context value.
  • On failure, returns NULL and sets last error to ERROR_INVALID_HANDLE.
KUSB_EXP BOOL KUSB_API LibK_Context_Init ( _inopt HANDLE  Heap,
_in PVOID  Reserved 
)

Initializes the global libusbK process context.

If this function is not called at startup, libusbK initializes the global libusbK process context automatically.

Parameters
[in]HeapA handle to the memory heap libusbK will use for dynamic memory allocation.
Note
The process context itself is always allocated from the proccess heap.
If Heap is NULL, dynamic memory is allocated from the proccess heap.
Parameters
[in]ReservedReserved for future use. Must set to NULL.
Returns
On success, TRUE. Otherwise FALSE. Use GetLastError() to get extended error information.
KUSB_EXP VOID KUSB_API LibK_Context_Free ( VOID  )

Frees the global libusbK process context.

If this function is not called on exit, libusbK frees the global libusbK process context automatically when it terminates.

Returns
NONE.