Ok it turns out that when using
https://github.com/espressif/esp-idf/tr ... ial_device
example, the device appears both on Ports as USB Serial device and also appears as USB Composite Device in Universal Serial Bus controllers in device manager.
Few questions, how can I change the usb device name from the USB Composite Davice to some custom name?
I assume I would need to change tinyusb_config_t
Code: Select all
ESP_LOGI(TAG, "USB initialization");
const tinyusb_config_t tusb_cfg = {
.device_descriptor = NULL,
.string_descriptor = NULL,
.external_phy = false,
#if (TUD_OPT_HIGH_SPEED)
.fs_configuration_descriptor = NULL,
.hs_configuration_descriptor = NULL,
.qualifier_descriptor = NULL,
#else
.configuration_descriptor = NULL,
#endif // TUD_OPT_HIGH_SPEED
};
If I provide custom .device_descriptor and .string_descriptor:
Code: Select all
tusb_desc_device_t const desc_device =
{
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0210, // at least 2.1 or 3.x for BOS & webUSB
// Use Interface Association Descriptor (IAD) for CDC
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
.idVendor = 0xCafe,
.idProduct = 1234,
.bcdDevice = 0x0100,
.iManufacturer = 0x01,
.iProduct = 0x02,
.iSerialNumber = 0x03,
.bNumConfigurations = 0x01
};
const char *str_desc[] = {
"TinyUSB Device",
"TinyUSB CDC ACM Device",
"1234567890", // Serial number
};
Code: Select all
ESP_LOGI(TAG, "USB initialization");
const tinyusb_config_t tusb_cfg = {
.device_descriptor = &desc_device,
.string_descriptor = str_desc,
.external_phy = false,
#if (TUD_OPT_HIGH_SPEED)
.fs_configuration_descriptor = NULL,
.hs_configuration_descriptor = NULL,
.qualifier_descriptor = NULL,
#else
.configuration_descriptor = NULL,
#endif // TUD_OPT_HIGH_SPEED
};
LOG:
Code: Select all
�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x15a0
load:0x403c8700,len:0x4
load:0x403c8704,len:0xd20
load:0x403cb700,len:0x2ee4
entry 0x403c8928
I (27) boot: ESP-IDF HEAD-HASH-NOTFOUND 2nd stage bootloader
I (27) boot: compile time Aug 8 2025 08:48:56
I (27) boot: Multicore bootloader
I (28) boot: chip revision: v0.1
I (31) boot: efuse block revision: v1.2
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (38) boot.esp32s3: SPI Mode : DIO
I (42) boot.esp32s3: SPI Flash Size : 2MB
I (46) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (53) boot: ## Label Usage Type ST Offset Length
I (59) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (66) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (72) boot: 2 factory factory app 00 00 00010000 00100000
I (79) boot: End of partition table
I (82) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0a8a4h ( 43172) map
I (97) esp_image: segment 1: paddr=0001a8cc vaddr=3fc92400 size=02b88h ( 11144) load
I (100) esp_image: segment 2: paddr=0001d45c vaddr=40374000 size=02bbch ( 11196) load
I (107) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=1cea4h (118436) map
I (133) esp_image: segment 4: paddr=0003cecc vaddr=40376bbc size=0b75ch ( 46940) load
I (143) esp_image: segment 5: paddr=00048630 vaddr=600fe100 size=0001ch ( 28) load
I (154) boot: Loaded app from partition at offset 0x10000
I (154) boot: Disabling RNG early entropy source...
I (164) cpu_start: Multicore app
I (174) cpu_start: Pro cpu start user code
I (174) cpu_start: cpu freq: 160000000 Hz
I (174) app_init: Application information:
I (174) app_init: Project name: tusb_serial_device
I (179) app_init: App version: 1
I (182) app_init: Compile time: Aug 8 2025 12:28:07
I (187) app_init: ELF file SHA256: e3810d13f...
I (191) app_init: ESP-IDF: HEAD-HASH-NOTFOUND
I (196) efuse_init: Min chip rev: v0.0
I (200) efuse_init: Max chip rev: v0.99
I (204) efuse_init: Chip rev: v0.1
I (208) heap_init: Initializing. RAM available for dynamic allocation:
I (214) heap_init: At 3FC961F8 len 00053518 (333 KiB): RAM
I (219) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (224) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (230) heap_init: At 600FE11C len 00001ECC (7 KiB): RTCRAM
I (236) spi_flash: detected chip: generic
I (239) spi_flash: flash io: dio
W (242) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (254) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (260) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (267) main_task: Started on CPU0
I (287) main_task: Calling app_main()
I (287) example: USB initialization
W (287) tusb_desc: No FullSpeed configuration descriptor provided, using default.
I (287) tusb_desc:
┌─────────────────────────────────┐
│ USB Device Descriptor Summary │
├───────────────────┬─────────────┤
│bDeviceClass │ 239 │
├───────────────────┼─────────────┤
│bDeviceSubClass │ 2 │
├───────────────────┼─────────────┤
│bDeviceProtocol │ 1 │
├───────────────────┼─────────────┤
│bMaxPacketSize0 │ 64 │
├───────────────────┼─────────────┤
│idVendor │ 0xcafe │
├───────────────────┼─────────────┤
│idProduct │ 0x4d2 │
│bNumConfigurations │ 0x1 │
└───────────────────┴─────────────┘
I (457) TinyUSB: TinyUSB Driver installed
I (457) example: USB initialization DONE
It will not change the USB device name how it appears on device manager, but instead it will show as USB device not recognized:
https://we.tl/t-MpbZqbfSSs