serial: Read USB strings for Windows display names [chromium/src : main]

0 views
Skip to first unread message

Helmut Januschka (Gerrit)

unread,
Jun 11, 2026, 11:46:43 AMJun 11
to Helmut Januschka, Reilly Grant, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Reilly Grant

Helmut Januschka added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Helmut Januschka . resolved

@rei...@chromium.org — I thought you'd be the best fit based on what I know so far, but let me know if I should assign someone else.

Happy to address anything you'd like changed. See the issue for screenshots; there's also sample Adafruit firmware here:

https://github.com/hjanuschka/usb-serial-tester/blob/main/usb_serial_tester/usb_serial_tester.ino

Open in Gerrit

Related details

Attention is currently required from:
  • Reilly Grant
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ie86c073f8dc3053faa69eca32b861c32edaaa9f8
Gerrit-Change-Number: 7893526
Gerrit-PatchSet: 4
Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Reilly Grant <rei...@chromium.org>
Gerrit-Attention: Reilly Grant <rei...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Jun 2026 15:46:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Reilly Grant (Gerrit)

unread,
Jun 16, 2026, 7:50:30 PM (12 days ago) Jun 16
to Helmut Januschka, Reilly Grant, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Helmut Januschka

Reilly Grant added 1 comment

Patchset-level comments
Reilly Grant . unresolved

This change duplicates a significant amount of code from `//services/device/usb`. Given that that code is running in parallel with `//services/device/serial` can you reuse the USB device enumeration it is already going to be doing to get the USB strings you need?

Open in Gerrit

Related details

Attention is currently required from:
  • Helmut Januschka
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie86c073f8dc3053faa69eca32b861c32edaaa9f8
    Gerrit-Change-Number: 7893526
    Gerrit-PatchSet: 4
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Reilly Grant <rei...@chromium.org>
    Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
    Gerrit-Comment-Date: Tue, 16 Jun 2026 23:50:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Helmut Januschka (Gerrit)

    unread,
    Jun 17, 2026, 11:47:54 AM (12 days ago) Jun 17
    to Helmut Januschka, Reilly Grant, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Reilly Grant

    Helmut Januschka added 1 comment

    Patchset-level comments
    Reilly Grant . resolved

    This change duplicates a significant amount of code from `//services/device/usb`. Given that that code is running in parallel with `//services/device/serial` can you reuse the USB device enumeration it is already going to be doing to get the USB strings you need?

    Helmut Januschka

    from what i understand, i see a few options here,

    [1] reuse `ParseUsbStringDescriptor` from `usb_descriptors.h` so we at least stop hand-rolling the UTF-16 string parse. Smallest diff, but it only de-dupes a little, the hub open/read and config parsing stay.

    [2] extract the hub descriptor-read into a shared helper so we stop duplicating the code. removes most of the duplicated code, but we'd still read the hub twice at runtime.

    [3] Consume the strings the USB service already reads via `UsbDeviceManager` so we don't read the hub twice at all, but it moves name enrichment onto an async path, and i am afraid it blows up the complexity (not afraid; just wanted to ask back)

    what option do you prefer?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Reilly Grant
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ie86c073f8dc3053faa69eca32b861c32edaaa9f8
      Gerrit-Change-Number: 7893526
      Gerrit-PatchSet: 4
      Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Reilly Grant <rei...@chromium.org>
      Gerrit-Attention: Reilly Grant <rei...@chromium.org>
      Gerrit-Comment-Date: Wed, 17 Jun 2026 15:47:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Reilly Grant <rei...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Reilly Grant (Gerrit)

      unread,
      Jun 17, 2026, 1:20:47 PM (12 days ago) Jun 17
      to Helmut Januschka, Reilly Grant, Chromium LUCI CQ, chromium...@chromium.org
      Attention needed from Helmut Januschka

      Reilly Grant added 1 comment

      Patchset-level comments
      Reilly Grant . unresolved

      This change duplicates a significant amount of code from `//services/device/usb`. Given that that code is running in parallel with `//services/device/serial` can you reuse the USB device enumeration it is already going to be doing to get the USB strings you need?

      Helmut Januschka

      from what i understand, i see a few options here,

      [1] reuse `ParseUsbStringDescriptor` from `usb_descriptors.h` so we at least stop hand-rolling the UTF-16 string parse. Smallest diff, but it only de-dupes a little, the hub open/read and config parsing stay.

      [2] extract the hub descriptor-read into a shared helper so we stop duplicating the code. removes most of the duplicated code, but we'd still read the hub twice at runtime.

      [3] Consume the strings the USB service already reads via `UsbDeviceManager` so we don't read the hub twice at all, but it moves name enrichment onto an async path, and i am afraid it blows up the complexity (not afraid; just wanted to ask back)

      what option do you prefer?

      Reilly Grant

      Thinking on the complexity of the various options, particularly as there are also threading and object lifetime issues to consider unless you use the `UsbDeviceManager` Mojo interface and make everything even more asynchronous... I think it does make sense to just query the hub directly from this code.

      What I ask is that we reuse any descriptor parsing code out of `usb_descriptors.h` so we only have one copy of that code since it is security-sensitive (parsing untrustworthy inputs). If you can deduplicate any of the hub request code that's a bonus but that might be too intertwined with how `UsbDeviceHandleWin` works.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Helmut Januschka
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ie86c073f8dc3053faa69eca32b861c32edaaa9f8
        Gerrit-Change-Number: 7893526
        Gerrit-PatchSet: 4
        Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
        Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
        Gerrit-Reviewer: Reilly Grant <rei...@chromium.org>
        Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
        Gerrit-Comment-Date: Wed, 17 Jun 2026 17:20:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Helmut Januschka <hel...@januschka.com>
        Comment-In-Reply-To: Reilly Grant <rei...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Helmut Januschka (Gerrit)

        unread,
        Jun 18, 2026, 12:30:56 AM (11 days ago) Jun 18
        to Helmut Januschka, android-bu...@system.gserviceaccount.com, Reilly Grant, Chromium LUCI CQ, chromium...@chromium.org, odejesu...@chromium.org, mattreyno...@chromium.org
        Attention needed from Reilly Grant

        Helmut Januschka added 1 comment

        Patchset-level comments
        File-level comment, Patchset 4:
        Reilly Grant . resolved

        This change duplicates a significant amount of code from `//services/device/usb`. Given that that code is running in parallel with `//services/device/serial` can you reuse the USB device enumeration it is already going to be doing to get the USB strings you need?

        Helmut Januschka

        from what i understand, i see a few options here,

        [1] reuse `ParseUsbStringDescriptor` from `usb_descriptors.h` so we at least stop hand-rolling the UTF-16 string parse. Smallest diff, but it only de-dupes a little, the hub open/read and config parsing stay.

        [2] extract the hub descriptor-read into a shared helper so we stop duplicating the code. removes most of the duplicated code, but we'd still read the hub twice at runtime.

        [3] Consume the strings the USB service already reads via `UsbDeviceManager` so we don't read the hub twice at all, but it moves name enrichment onto an async path, and i am afraid it blows up the complexity (not afraid; just wanted to ask back)

        what option do you prefer?

        Reilly Grant

        Thinking on the complexity of the various options, particularly as there are also threading and object lifetime issues to consider unless you use the `UsbDeviceManager` Mojo interface and make everything even more asynchronous... I think it does make sense to just query the hub directly from this code.

        What I ask is that we reuse any descriptor parsing code out of `usb_descriptors.h` so we only have one copy of that code since it is security-sensitive (parsing untrustworthy inputs). If you can deduplicate any of the hub request code that's a bonus but that might be too intertwined with how `UsbDeviceHandleWin` works.

        Helmut Januschka

        Done, kept the direct hub read and switched `ReadUsbStringDescriptor()` to reuse `device::ParseUsbStringDescriptor()`

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Reilly Grant
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ie86c073f8dc3053faa69eca32b861c32edaaa9f8
          Gerrit-Change-Number: 7893526
          Gerrit-PatchSet: 6
          Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
          Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
          Gerrit-Reviewer: Reilly Grant <rei...@chromium.org>
          Gerrit-Attention: Reilly Grant <rei...@chromium.org>
          Gerrit-Comment-Date: Thu, 18 Jun 2026 04:30:29 +0000
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages