-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
As of now, the serial number string descriptor of the USB subsystem is a constant defined at compilation time:
zephyr/subsys/usb/usb_descriptor.c
Line 620 in 924e8aa
| .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:
zephyr/subsys/bluetooth/controller/hci/hci.c
Line 1852 in 5475de1
| sys_put_le32(NRF_FICR->DEVICEADDR[0], &addr->bdaddr.val[0]); |
zephyr/subsys/bluetooth/controller/hci/hci.c
Line 1858 in 5475de1
| 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.