ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::usb_host Namespace Reference

Data Structures

struct  TransferRequest
 
struct  TransferStatus
 
class  USBClient
 
struct  UsbDeviceInfo
 Identity of a connected USB device, copied out of the descriptors the USB host stack caches for the lifetime of the connection. More...
 
struct  UsbEvent
 
class  USBHost
 

Typedefs

using trq_bitmask_t = std::conditional<(MAX_REQUESTS <= 16), uint16_t, uint32_t>::type
 
using transfer_cb_t = std::function<void(const TransferStatus &)>
 

Enumerations

enum  EventType : uint8_t { EVENT_DEVICE_NEW , EVENT_DEVICE_GONE }
 
enum  ClientState {
  USB_CLIENT_INIT = 0 , USB_CLIENT_OPEN , USB_CLIENT_CLOSE , USB_CLIENT_GET_DESC ,
  USB_CLIENT_GET_INFO , USB_CLIENT_CONNECTED
}
 

Functions

 ESPHOME_LOG_TAG (TAG, "usb_host")
 
bool copy_descriptor_string (const usb_str_desc_t *desc, std::span< char, DESC_STRING_BUF_SIZE > buffer)
 Copy a USB string descriptor into a NUL-terminated buffer.
 

Typedef Documentation

◆ transfer_cb_t

using esphome::usb_host::transfer_cb_t = std::function<void(const TransferStatus &)>

Definition at line 89 of file usb_host.h.

◆ trq_bitmask_t

using esphome::usb_host::trq_bitmask_t = std::conditional<(MAX_REQUESTS <= 16), uint16_t, uint32_t>::type

Definition at line 70 of file usb_host.h.

Enumeration Type Documentation

◆ ClientState

Enumerator
USB_CLIENT_INIT 
USB_CLIENT_OPEN 
USB_CLIENT_CLOSE 
USB_CLIENT_GET_DESC 
USB_CLIENT_GET_INFO 
USB_CLIENT_CONNECTED 

Definition at line 142 of file usb_host.h.

◆ EventType

Enumerator
EVENT_DEVICE_NEW 
EVENT_DEVICE_GONE 

Definition at line 101 of file usb_host.h.

Function Documentation

◆ copy_descriptor_string()

bool esphome::usb_host::copy_descriptor_string ( const usb_str_desc_t * desc,
std::span< char, DESC_STRING_BUF_SIZE > buffer )

Copy a USB string descriptor into a NUL-terminated buffer.

A missing descriptor copies as an empty string. Returns false when a descriptor contains non-ASCII characters, UTF-16 to UTF-8 conversion is not currently implemented.

Definition at line 150 of file usb_host_client.cpp.

◆ ESPHOME_LOG_TAG()

esphome::usb_host::ESPHOME_LOG_TAG ( TAG ,
"usb_host"  )