Chapter 2. API Reference
• This function marks all devices as waiting to be freed
• If a device is not opened by any clients, it will be freed immediately
• If a device is opened by at least one client, the device will be free when the last client closes that device.
• Wait
for
usb_host_lib_handle_events() in order to know when all devices have been freed
• This function is useful when cleaning up devices before uninstalling the USB Host Library
Return
• ESP_ERR_NOT_FINISHED: There are one or more devices that still need to be freed. Wait for
USB_HOST_LIB_EVENT_FLAGS_ALL_FREE event
• ESP_OK: All devices already freed (i.e., there were no devices)
• Other: Error
esp_err_t
usb_host_device_addr_list_fill(int
Fill a list of device address.
• This function fills an empty list with the address of connected devices
• The Device addresses can then used in usb_host_device_open()
• If there are more devices than the list_len, this function will only fill up to list_len number of devices.
Return esp_err_t
Parameters
• [in] list_len: Length of the empty list
• [inout] dev_addr_list: Empty list to be filled
• [out] num_dev_ret: Number of devices
esp_err_t usb_host_device_info(usb_device_handle_t
Get device's information.
• This function gets some basic information of a device
• The device must be opened first before attempting to get its information
Note This function can block
Return esp_err_t
Parameters
• [in] dev_hdl: Device handle
• [out] dev_info: Device information
esp_err_t usb_host_get_device_descriptor(usb_device_handle_t
Get device's device descriptor.
• A client must call usb_host_device_open() first
• No control transfer is sent. The device's descriptor is cached on enumeration
• This function simple returns a pointer to the cached descriptor
Note No control transfer is sent. The device's descriptor is cached on enumeration
Return esp_err_t
Parameters
• [in] dev_hdl: Device handle
• [out] device_desc: Device descriptor
esp_err_t usb_host_get_active_config_descriptor(usb_device_handle_t
Get device's active configuration descriptor.
• A client must call usb_host_device_open() first
• No control transfer is sent. The device's active configuration descriptor is cached on enumeration
• This function simple returns a pointer to the cached descriptor
Note This function can block
Note No control transfer is sent. A device's active configuration descriptor is cached on enumeration
Return esp_err_t
Parameters
Espressif Systems
the
USB_HOST_LIB_EVENT_FLAGS_ALL_FREE
Submit Document Feedback
list_len,
uint8_t
*num_dev_ret)
dev_hdl,
usb_device_info_t
usb_device_desc_t
**device_desc)
usb_config_desc_t
490
flag
to
be
set
*dev_addr_list,
int
*dev_info)
dev_hdl,
const
dev_hdl, const
**config_desc)
Release v4.4
by
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?