Skip to content

USB device serial numbers may change between current device stack and the device_next stack #78979

@henrikbrixandersen

Description

@henrikbrixandersen

Describe the bug
USB device serial numbers may change between current device stack and the device_next stack for the same MCU.

To Reproduce
Steps to reproduce the behavior:

  1. west build -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse/
  2. west flash
  3. Note down the reported USB serial number (see below).
  4. west build -p always -b frdm_k64f/mk64f12 samples/subsys/usb/hid-mouse/ -- -DCONF_FILE="usbd_next_prj.conf" -DEXTRA_DTC_OVERLAY_FILE="usbd_next.overlay"
  5. west flash
  6. Note down the reported USB serial number (see below)

Expected behavior
The USB serial number maintains its value across the two USB device stacks.

Impact
A firmware update including a switch from the device stack to the device_next stack can result in changed USB serial numbers for devices in the field, causing issues when the USB serial number is used to uniquely identify a USB device (e.g. multiple USB debug adapters, multiple USB serial ports, multiple USB network adapters, ... connected to the same USB host).

Logs and console output
Linux lsusb output when using the current device stack:

$ lsusb -d 2fe3:0007 -v|grep iSerial
  iSerial                 3 4E4548322008002D

Linux lsusb output when using the current device_next stack:

$ lsusb -d 2fe3:0007 -v|grep iSerial
  iSerial                 3 FFFFFFFF4E4548322008002D

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK
  • Commit SHA: 99e6280

Additional context
The current USB device stack allows limiting the length of the reported USB serial number via CONFIG_USB_DEVICE_SN. By default, the USB serial number string is limited to 16 characters (based on the length of the string "0123456789ABCDEF"). The new USB device_next stack does not allow for this, causing the full length of the HWID being used.

I am labeling this as a bug, as this is how it will likely be seen from anybody implementing a USB device based on Zephyr.

Metadata

Metadata

Assignees

Labels

ExperimentalExperimental features not enabled by defaultarea: USBUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions