From: "James J. Lippard" Subject: uhidev: fix USB_GET_REPORT returning EIO on report-ID devices To: tech@openbsd.org Date: Thu, 5 Nov 2026 10:27:13 -0700 On any device with report IDs, USB_GET_REPORT on a uhid(4) child always fails with EIO; USB_SET_REPORT works. I hit this with an APC Back-UPS NS 1500M2, where all 57 uhid children fail while upd(4) works. uhidev_get_report() adds a byte for the report ID and strips it from the data, but returns the transfer length including that byte, so the != size check in uhidev_ioctl() never passes. uhidev_get_report_async_cb() already subtracts the ID byte, which is why upd(4) is unaffected. This diff does the same in the sync path, and treats a zero-length reply as an error, as 1.114 does in the async path. --- uhidev.c.orig Thu Nov 5 10:22:00 2026 +++ uhidev.c Thu Nov 5 10:24:23 2026 @@ -874,6 +874,10 @@ /* Skip the reportID. */ if (id > 0) { + if (actlen == 0) + actlen = -1; + else if (actlen > 0) + actlen--; memcpy(data, buf + 1, len - 1); free(buf, M_TEMP, len); } Unrelated, while looking at this file: commit 1.115 drops any interrupt report longer than its declared size. Some HID devices pad interrupt reports out to the full USB packet size; would it be better to truncate those to the declared size rather than drop them? I haven’t confirmed a device that does this. -- Jim Lippard lippard-openbsd@discord.org https://discord.org/ GPG Key ID: 0x99FD5CD6