Chapter 2. API Reference
Given a configuration descriptor, get an endpoint descriptor based on it's bEndpointAddress, bAlternateSet-
ting, and bInterfaceNumber.
Return const usb_ep_desc_t* Pointer to endpoint descriptor, NULL if not found.
Parameters
• [in] config_desc: Pointer to the start of a full configuration descriptor
• [in] bInterfaceNumber: Interface number
• [in] bAlternateSetting: Alternate setting number
• [in] bEndpointAddress: Endpoint address
• [out] offset: Byte offset of the endpoint descriptor relative to the start of the configuration
descriptor. Can be NULL
static int usb_round_up_to_mps(int num_bytes, int mps)
Round up to an integer multiple of endpoint's MPS.
This is a convenience function to round up a size/length to an endpoint's MPS (Maximum packet size). This
is useful when calculating transfer or buffer lengths of IN endpoints.
Return int Round up integer multiple of MPS
Parameters
• [in] num_bytes: Number of bytes
• [in] mps: MPS
esp_err_t usb_print_descriptors(usb_device_handle_t
Prints usb descriptors.
Return esp_err_t
Parameters
• [in] device: Handle to device
• [in] class_specific_cb: Optional callback to print class specific descriptors
Type Definitions
typedef void (*print_class_descriptor_cb)(const
Print class specific descriptor callback.
Optional callback to be provided to usb_print_descriptors() function. The callback is called when when a
non-standard descriptor is encountered. The callback should decode the descriptor as print it.
Header File
•
components/usb/include/usb/usb_types_stack.h
Structures
struct usb_device_info_t
Basic information of an enumerated device.
Public Members
usb_speed_t
speed
Device's speed
uint8_t dev_addr
Device's address
uint8_t bMaxPacketSize0
The maximum packet size of the device's default endpoint
uint8_t bConfigurationValue
Device's current configuration number
Espressif Systems
class_specific_cb)
496
Submit Document Feedback
device,
print_class_descriptor_cb
usb_standard_desc_t
*)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?