Skip to content

Allow configuring the USB serial number string in runtime #6593

@IvanSanchez

Description

@IvanSanchez

As of now, the serial number string descriptor of the USB subsystem is a constant defined at compilation time:

.bString = CONFIG_USB_DEVICE_SN,

However, there is a very strong use case to flash the same firmware image into more than one board, and have them report different serial numbers through USB. In particular, there is the use case of the nRF5 SoCs, which have a small region of read-only memory from which unique numbers are fetched to seed the bluetooth static address:

sys_put_le32(NRF_FICR->DEVICEADDR[0], &addr->bdaddr.val[0]);

BT_ADDR_SET_STATIC(&addr->bdaddr);

Using those values can provide unique serial numbers. Other boards might have different methods of creating unique serial numbers (e.g. by reading a section of flash memory, or querying a peripheral when starting up).

I am also aware that developers can specify their own complete USB device descriptors, as illustrated in the WebUSB sample, but even there the descriptor is declared as static.


Thus, I request a way of building USB device descriptors allowing the developer to specify a (utf16-encoded) string for the serial number while keeping the rest of the structure static.

Metadata

Metadata

Assignees

Labels

FeatureA planned feature with a milestonearea: USBUniversal Serial Bus

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions