Chapter 2. API Reference
Type Definitions
typedef struct usb_host_client_handle_s *usb_host_client_handle_t
Handle to a USB Host Library asynchronous client.
An asynchronous client can be registered using usb_host_client_register()
Note Asynchronous API
typedef void (*usb_host_client_event_cb_t)(const usb_host_client_event_msg_t
*event_msg, void *arg)
Client event callback.
• Each client of the USB Host Library must register an event callback to receive event messages from the
USB Host Library.
• The client event callback is run from the context of the clients usb_host_client_handle_events() function
Enumerations
enum usb_host_client_event_t
The type event in a client event message.
Values:
USB_HOST_CLIENT_EVENT_NEW_DEV
A new device has been enumerated and added to the USB Host Library
USB_HOST_CLIENT_EVENT_DEV_GONE
A device opened by the client is now gone
Header File
• components/usb/include/usb/usb_helpers.h
Functions
const usb_standard_desc_t *usb_parse_next_descriptor(const usb_standard_desc_t
*cur_desc, uint16_t wTotalLength, int
*offset)
Get the next descriptor.
Given a particular descriptor within a full configuration descriptor, get the next descriptor within the configu-
ration descriptor. This is a convenience function that can be used to walk each individual descriptor within a
full configuration descriptor.
Return usb_standard_desc_t* Next descriptor, NULL if end of configuration descriptor reached
Parameters
• [in] cur_desc: Current descriptor
• [in] wTotalLength: Total length of the configuration descriptor
• [inout] offset: Byte offset relative to the start of the configuration descriptor. On input, it is
the offset of the current descriptor. On output, it is the offset of the returned descriptor.
const usb_standard_desc_t *usb_parse_next_descriptor_of_type(const
usb_standard_desc_t
*cur_desc, uint16_t
wTotalLength, uint8_t
bDescriptorType, int
*offset)
Get the next descriptor of a particular type.
Given a particular descriptor within a full configuration descriptor, get the next descriptor of a particular type
(i.e., using the bDescriptorType value) within the configuration descriptor.
Return usb_standard_desc_t* Next descriptor, NULL if end descriptor is not found or configuration descrip-
tor reached
Parameters
• [in] cur_desc: Current descriptor
Espressif Systems 494
Submit Document Feedback
Release v4.4