WebHID: a Report ID before the first Collection is ignored

#574273446 Filed 2026-10-16 Assigned · P3/S3 CL 8669861

The bug

A Report ID item is a HID global item: it stays in effect until it is changed, so it is valid before the first Collection item. The WebHID parsing algorithm sets globalState["reportId"] unconditionally (hid.spec.whatwg.org). Chromium's report descriptor parser only updated the current report ID while a collection was open, so every report in the collection that followed was parsed with report ID 0 and the device looked like it does not use report IDs at all.

Descriptor used by this sampler

The test case in the issue uses Usage (Keyboard), whose reports are always protected by WebHID and therefore unreadable from a page. This sampler keeps the same shape but on a vendor-defined usage page.

0x85, 0x01,        // Report ID (1)              <-- before any collection
0x06, 0x00, 0xFF,  // Usage Page (Vendor 0xFF00)
0x09, 0x01,        // Usage (0x01)
0xA1, 0x01,        // Collection (Application)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x02,        //   Report Count (2)
0x09, 0x02,        //   Usage (0x02)
0x81, 0x02,        //   Input (Data,Var,Abs)
0x09, 0x03,        //   Usage (0x03)
0x91, 0x02,        //   Output (Data,Var,Abs)
0xC0               // End Collection

Repro steps

1. Flash one of the sketches below (Adafruit Feather nRF52840 Express, or an ESP32-S3 / S2 devkit on its native USB port).
2. On Linux, install 99-hid-reportid-repro.rules so Chrome may open the hidraw node, then replug the board.
3. Click Connect device below and pick HID ReportID Repro.
4. Repeat on a build with CL 8669861 applied and compare the verdict.

Expected vs actual

CheckExpected (per spec)Actual (unpatched Chrome)
collections[0].inputReports[0].reportId10
collections[0].outputReports[0].reportId10
sendReport(1, ...)resolvesrejects
sendReport(0, ...)rejectsresolves
inputreport event .reportId10

Live test

No device connected.
CheckValueResult
inputReports[0].reportId--
outputReports[0].reportId--
sendReport(1, ...)--
sendReport(0, ...)--
inputreport event .reportId--
Log output appears here.

Firmware

⬇ feather_nrf52840.ino ⬇ esp32s3.ino ⬇ udev rule (Linux) ⬇ README

Links

Issue: crbug.com/574273446
Fix CL: crrev.com/c/8669861
Spec: WebHID, parsing the report descriptor
Parser: services/device/hid/hid_collection.cc