Repository navigation
Conversation
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#21781
components: [api, serial_proxy, usb_host, usb_uart]
refresh: 1h(Added by the PR bot) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #21781 +/- ##
=======================================
Coverage 96.83% 96.83%
=======================================
Files 91 91
Lines 21829 21829
Branches 3461 3461
=======================================
Hits 21138 21138
Misses 525 525
Partials 166 166 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
Memory Impact AnalysisComponents:
📊 Component Memory Breakdown
🔍 Symbol-Level Changes (click to expand)Changed Symbols
This analysis runs automatically when components change. Memory usage is measured from a merged configuration with 2 components. |
|
ESPHome Bot (@esphbot) review |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Warning
Important issues found.
- Two different interface_description values do not make two clients disjoint
|
Regarding bot point 1: this is an architectural issue in ESPHome and can be fixed in a follow-up PR. There are a few devices on the market that do this (HUSBZB-1 has a Zigbee interface and a Z-Wave interface) but it's very rare in practice. That being said, it should be fixed. But not in this PR. ESPHome Bot (@esphbot) Re-review. |
|
❌ Unknown command Code & Development
Pull Requests
Usage: |
|
ESPHome Bot (@esphbot) review |
Agreed, deferring to follow-up. Now marked [Deferred], non-blocking. Follow-up idea: record matched interface in |
PR Review — [usb_host] Read
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
👋 Hi there! This PR modifies 10 file(s) with codeowners. Keith Burzinski (@kbx81), Clyde Stubbs (@clydebarrow), @esphome/core - As codeowner(s) of the affected files, your review would be appreciated! 🙏 Note: Automatic review request may have failed, but you're still welcome to review. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved USB descriptor-transfer lifecycle bugs and unchecked allocation can cause assertions or crashes, while overlapping filters can make clients claim the same interface.
5 open issues
Overlapping interface filters cause duplicate CDC channel claims · New Handle string transfer allocation failure before dereferencing · New Defer device closure while descriptor transfers are pending · New Defer configuration requests during descriptor acquisition · New Clear stale string completions during device teardown · New
What changed in this PR
This PR adds USB interface descriptions to ESPHome’s USB host and serial proxy support, bringing serial-port identity reporting closer to Linux/udev.
Changes:
- Reads and caches
iInterfacestrings for connected USB UART channels. - Adds interface-description filters and exposes descriptions through the native API.
- Extends filter-validation, component-build, and protobuf-encoding tests.
| File | Description |
|---|---|
tests/unit_tests/components/test_usb_host.py |
Adds interface-filter overlap cases. |
tests/components/usb_uart/common.yaml |
Exercises USB UART interface filtering. |
tests/components/usb_host/test.esp32-s3-idf.yaml |
Exercises interface filtering on ESP32-S3. |
tests/components/usb_host/test.esp32-p4-idf.yaml |
Exercises interface filtering on ESP32-P4. |
tests/components/serial_proxy/test_usb_device_descriptor.cpp |
Tests interface-description encoding. |
esphome/components/usb_uart/usb_uart.h |
Adds channel-description storage and read hooks. |
esphome/components/usb_uart/usb_uart.cpp |
Reads descriptions before enabling channels. |
esphome/components/usb_host/usb_host.h |
Declares descriptor-transfer state and helpers. |
esphome/components/usb_host/usb_host_client.cpp |
Implements asynchronous string reads and filtering. |
esphome/components/usb_host/__init__.py |
Adds interface-description validation and code generation. |
esphome/components/serial_proxy/serial_proxy.cpp |
Includes descriptions in port identity reports. |
esphome/components/api/api.proto |
Adds the interface-description protocol field. |
esphome/components/api/api_pb2.h |
Adds generated field storage. |
esphome/components/api/api_pb2.cpp |
Updates generated encoding and size calculation. |
esphome/components/api/api_pb2_dump.cpp |
Includes descriptions in protocol debug output. |
Review effort: Balanced


What does this implement/fix?
Read the
iInterfacestring descriptor for USB interfaces. Many devices use a different string for the interface description and this technically is the final piece to give ESPHome feature-parity with Linux + udev when listing serial ports.Tested with puddly/serialx#145:
Types of changes
Related issue or feature (if applicable):
Pull request in esphome.io with documentation (if applicable):
interface_descriptionfiltering esphome.io#7947Pull request in developers.esphome.io with developer documentation (if applicable):
Test Environment
Example entry for
config.yaml:# Example config.yamlChecklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: