// WebHID unit-exponent -8 repro device for Adafruit Feather nRF52840 Sense. // // Chromium issue 571496929: UnitFactorExponentToInt() mapped the 4-bit // two's complement value 0x8 to +8 instead of -8. // // Board settings (Arduino IDE / arduino-cli): // Board: "Adafruit Feather nRF52840 Sense" (adaudio nrf core) // Requires: Adafruit TinyUSB Arduino library (v3.x) // // Enumerates as VID 0x239A (Adafruit). The report descriptor sets: // Unit Exponent = 0x08 -> WebHID unitExponent should read -8 // Unit = 0x08888881 -> SI linear, all six factor nibbles 0x8 // -> each unitFactor*Exponent should read -8 #include "Adafruit_TinyUSB.h" static const uint8_t kReportDescriptor[] = { 0x05, 0x8F, // Usage Page (Vendor Defined 0x8F) 0x09, 0x01, // Usage (0x01) 0xA1, 0x01, // Collection (Application) 0x55, 0x08, // Unit Exponent (0x08 == -8) 0x67, 0x81, 0x88, 0x88, 0x08, // Unit (LE for 0x08888881) 0x15, 0x00, // Logical Minimum (0) 0x26, 0xFF, 0x00, // Logical Maximum (255) 0x75, 0x08, // Report Size (8) 0x95, 0x04, // Report Count (4) 0x09, 0x02, // Usage (0x02) 0x81, 0x02, // Input (Data,Var,Abs) 0xC0 // End Collection }; Adafruit_USBD_HID usb_hid; void setup() { usb_hid.setReportDescriptor(kReportDescriptor, sizeof(kReportDescriptor)); usb_hid.setPollInterval(2); usb_hid.begin(); } void loop() { if (!TinyUSBDevice.mounted()) { delay(10); return; } static uint8_t counter = 0; uint8_t report[4] = { counter++, 0x2A, 0x42, 0x08 }; usb_hid.sendReport(0, report, sizeof(report)); delay(500); }