Skip to content

USB device descriptor is missing iSerialNumber — breaks WebUSB auto-reconnect after unplug #37

@NielsLeenheer

Description

@NielsLeenheer

The Helios Laser DAC USB descriptor does not populate the iSerialNumber string descriptor. As a result, every physical reconnection presents as a new, untrusted device to the host OS and browser, making reliable programmatic reconnection impossible from WebUSB-based applications.

Steps to reproduce

  1. Plug the DAC in and grant WebUSB permission in a page using navigator.usb.requestDevice().
  2. Control the DAC normally to confirm it works.
  3. Unplug the DAC.
  4. Plug it back into the same port.
  5. Call navigator.usb.getDevices() — the replugged device is not in the list.

This is the data from the Chrome device log (chrome://device-log):

USBUser  USB device removed: guid=4bc83e26-b9c7-4fc1-bd8f-ce091e48004b
USBUser  USB device added:   vendor=4617 "Gitle Mikkelsen", product=58624 "Helios Laser DAC", serial="", guid=fe0da530-2417-4b6f-9ed0-f49b2e3c8ecf
USBUser  USB device removed: guid=fe0da530-2417-4b6f-9ed0-f49b2e3c8ecf
USBUser  USB device added:   vendor=4617 "Gitle Mikkelsen", product=58624 "Helios Laser DAC", serial="", guid=b0e9e62e-dfd4-447b-a091-f567a93597ac

Same physical device, two consecutive unplug/replug cycles, note the changing GUID and empty serial. Each Added is treated as a distinct, previously-unpaired device because there is no serial to match against. More information about this requirement for pairing automatically: https://wicg.github.io/webusb/#permission-storage — specifically: "The same USB device is considered equivalent to a previously-observed device if they have matching vendor ID, product ID, and serial number." An empty serial fails the match.

Requested fix:
Populate iSerialNumber in the USB device descriptor with a unique per-unit value. For example using the microcontrollers hardware unique id, or randomly generated on boot and written to flash memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions