Add serialType field to auto-select CDC vs UART firmware variants#685
Open
DTTerastar wants to merge 2 commits intoesphome:mainfrom
Open
Add serialType field to auto-select CDC vs UART firmware variants#685DTTerastar wants to merge 2 commits intoesphome:mainfrom
DTTerastar wants to merge 2 commits intoesphome:mainfrom
Conversation
Adds an optional `serialType: "cdc" | "uart"` field to the Build interface. When multiple builds share the same chipFamily, the one matching the detected connection type is selected automatically. Connection type is detected via port.getInfo(): Espressif native USB CDC devices are identified by VID 0x303a and known CDC product IDs. Builds without serialType serve as a generic fallback for any connection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
serialType: "cdc" | "uart"field to theBuildinterface in the manifest schema0x303a) or an external USB-to-UART bridge viaport.getInfo()chipFamilyMotivation
Chips like ESP32-S3 and ESP32-C3 can be connected either via their built-in USB CDC port or via an external USB-to-UART bridge. These two connection methods require different firmware builds (different compile flags). Previously, users had to manually choose the correct variant — or the wrong firmware could be flashed silently.
This was originally requested in #383, which was closed with the conclusion that detecting the connection type was not possible. However,
port.getInfo()from the Web Serial API does expose the USB vendor and product IDs before any communication begins, making detection straightforward. Espressif's native USB CDC devices are identifiable by VID0x303aand known CDC product IDs, as noted in the discussion on #383 itself.The Tasmota approach (single firmware that detects CDC at runtime) is a valid alternative, but is not always available — particularly for projects that need separate binaries for each transport type. This feature is purely additive and requires no changes for projects that don't need it.
Behavior
Build selection priority:
chipFamily+serialTypematching the detected connectionchipFamilyand noserialTypespecifiedManifests without
serialTypeare completely unaffected — existing single-variant manifests continue to work as before.Example manifest
{ "chipFamily": "ESP32-S3", "serialType": "uart", "parts": [...] }, { "chipFamily": "ESP32-S3", "serialType": "cdc", "parts": [...] }Closes #383
Related: #331