Allow USB VID/PID to be overridden from the command line - #292
Open
vaulttec-dev wants to merge 1 commit into
Open
vaulttec-dev wants to merge 1 commit into
vaulttec-dev wants to merge 1 commit into
Conversation
The ESP path resolved them from CONFIG_TINYUSB_DESC_CUSTOM_VID, but CONFIG_* only exist after project(), while these assignments run before it, so the sdkconfig values were always ignored. Guard the defaults instead so -DUSB_VID/-DUSB_PID work on every target.
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.
Problem
-DUSB_VID/-DUSB_PIDhave no effect:CMakeLists.txtassigns bothunconditionally at the top, before anything can override them.
On ESP-IDF there is a second path that looks like it should work —
picokeys_sdk_import.cmakereadsCONFIG_TINYUSB_DESC_CUSTOM_VID— but it cannot:CONFIG_*variables only exist afterproject(), and these assignments run beforeit. Setting the values in
sdkconfigtherefore does nothing, and the build silentlykeeps
2E8A:10FE.Reproduced on ESP-IDF v5.5.5, target esp32s3: with
CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=nandCONFIG_TINYUSB_DESC_CUSTOM_VID=0x1209present in the generated
sdkconfig, the build still reportsUSB VID/PID: 0x2E8A:0x10FE.This matters for anyone building their own device: the README notes that
distributing a binary under a VID/PID you do not own is not allowed, but the
documented way to change it does not work.
Fix
Guard the two assignments so an externally supplied value wins:
Defaults are unchanged, so existing builds behave exactly as before. The
VIDPID=presets keep working. Verified on esp32s3; the value now reaches the descriptor.