Skip to content

Set USB Device Descriptor (iInterface) #11394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
JimSHED opened this issue May 23, 2025 · 0 comments
Open
1 task done

Set USB Device Descriptor (iInterface) #11394

JimSHED opened this issue May 23, 2025 · 0 comments
Labels
Type: Feature request Feature request for Arduino ESP32

Comments

@JimSHED
Copy link

JimSHED commented May 23, 2025

Related area

USB Device

Hardware specification

ESP32-S2, ESP32-S3, ESP32-P4

Is your feature request related to a problem?

The USB API already provides useful functions for setting VID, PID, etc., but a crucial one I feel it is missing is iInterface, (which it seems most people online refer generically to as "Device Descriptor") instead using the TinyUSB default.

The most immediate and practical example of where this is useful is when acting as a CDC working with WebSerial, where (at least Windows) uses the iInterface value to name the devices to choose from. This allows users to set human-readable, unique names for their devices, making them easier to pick out of the list of all serial devices on your computer. Right now, multiple ESPs acting as CDC devices are indistinguishable from one another, and have a name that isn't relevant to them being an ESP32 ("TinyUSB CDC").

By setting the iInterface the end-user would now see;

Image

While WebSerial does allow for filtering by VID and PID, it is on the web app to implement it, and still only filters to a discrete product, not instances of a product.

Describe the solution you'd like

A simple USB.setDescriptor("This is my device!") or USB.setiInterface("This is my device!"), if possible, would be easily understood from a user standpoint and follow the convention for VID, PID, etc. that the USB API already uses.

The name "iInterface" doesn't lend itself well to a function since it breaks camel casing, and it is also not a well-known term, so the more generic option of Descriptor may be better even if not as correct.

Describe alternatives you've considered

It is currently possible to set a custom iInterface by changing the information in the Arduino package installed on your computer, which is not very convenient. For instance with a CDC device;

  1. Navigate to where Arduino installs packages and find USBCDC.cpp.
    Mine: C:\Users\Jim\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.1\cores\esp32\USBCDC.cpp
  2. Find "tinyusb_add_string_descriptor", and replace "TinyUSB CDC" with your preferred iInterface value.
  3. Save the file, compile and upload code.
  4. Repeat this process any time your packages are updated, you want to change your descriptor, etc.
    This also means you cannot publish open-source projects with a custom iInterface without forking and including a custom version of arduino-esp32, or just telling users how to edit their own arduino-esp32.

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@JimSHED JimSHED added the Type: Feature request Feature request for Arduino ESP32 label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature request Feature request for Arduino ESP32
Projects
None yet
Development

No branches or pull requests

1 participant