|
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... | |
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... | |
General libusbK library functions, defines, and structures.
#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)
addr | bEndpointAddress 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)
addr | bEndpointAddress field of a USB_ENDPOINT_DESCRIPTOR |
enum KLIB_HANDLE_TYPE |
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. |
enum BMREQUEST_TYPE |
bmRequest.Type
Enumerator | |
---|---|
BMREQUEST_TYPE_STANDARD |
Standard request. See USB_REQUEST_ENUM. |
BMREQUEST_TYPE_CLASS |
Class-specific request. |
BMREQUEST_TYPE_VENDOR |
Vendor-specific request. |
enum BMREQUEST_RECIPIENT |
enum USB_GETSTATUS |
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. |
enum USB_DESCRIPTOR_TYPE |
Standard USB descriptor types. For more information, see section 9-5 of the USB 3.0 specifications.
Values used in the bmAttributes
field of a USB_CONFIGURATION_DESCRIPTOR.
enum USB_REQUEST_ENUM |
USB defined request codes.
USB defined class codes.
see http://www.usb.org/developers/defined_class for more information.
enum KUSB_PROPERTY |
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 |
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. |
KUSB_EXP VOID KUSB_API LibK_GetVersion | ( | _out PKLIB_VERSION | Version | ) |
Gets the internal user context for the specified KLIB_HANDLE.
[out] | Version | Receives the libusbK library verson information. |
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.
[in] | Handle | The handle containg the context to retrieve. |
[in] | HandleType | Handle type of Handle . |
ERROR_INVALID_HANDLE
. 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.
[in] | Handle | The handle containg the context to set. |
[in] | HandleType | Handle type of Handle . |
[in] | ContextValue | Value to assign to the handle user context space. |
GetLastError()
to get extended error information. 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.
[in] | Handle | The handle containg the cleanup callback function to set. |
[in] | HandleType | Handle type of Handle . |
[in] | CleanupCB | User supplied callback function to execute when the handles internal reference count reaches 0. |
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.
[out] | DriverAPI | A driver API structure to populate. |
[in] | DriverID | The driver id of the API set to retrieve. See KUSB_DRVID |
GetLastError()
to get extended error information. KUSB_EXP BOOL KUSB_API LibK_IsFunctionSupported | ( | _in PKUSB_DRIVER_API | DriverAPI, |
_in UINT | FunctionID | ||
) |
Checks if the driver supports a function.
[in] | DriverAPI | A driver API structure. See LibK_LoadDriverAPI |
[in] | FunctionID | The function to check. See KUSB_FNID |
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.
[out] | DriverAPI | A driver API structure to populate. |
[in] | UsbHandle | Handle containing the desired driver API. |
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.
[out] | ProcAddress | Reference to a function pointer that will receive the API function pointer. |
[in] | DriverID | The driver id of the API to use. See KUSB_DRVID |
[in] | FunctionID | The function id. See KUSB_FNID |
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.
[in] | HandleType | The handle type which will be assigned the default ContextValue. |
[in] | ContextValue | Value assigned to the default user context for the specified KLIB_HANDLE_TYPE. |
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.
[in] | HandleType | Handle type used to retrieve the default user context. |
ERROR_INVALID_HANDLE
. Initializes the global libusbK process context.
If this function is not called at startup, libusbK initializes the global libusbK process context automatically.
[in] | Heap | A handle to the memory heap libusbK will use for dynamic memory allocation. |
[in] | Reserved | Reserved for future use. Must set to NULL. |
GetLastError()
to get extended error information.