diff options
| author | Vladimir Kondratyev <wulf@FreeBSD.org> | 2025-09-22 08:37:19 +0000 |
|---|---|---|
| committer | Vladimir Kondratyev <wulf@FreeBSD.org> | 2025-09-22 08:37:19 +0000 |
| commit | 8f496952e3e6cdd531675a44b84b3f1954532afb (patch) | |
| tree | 02851ac808ae476d0cc0f6f606a228b191ef0965 | |
| parent | 0ec13430c583830cc4d29640787e2d154b140e31 (diff) | |
iichid(4): Always use wMaxInputLength bytes as input report length
Lower values may result in non-acknowledged interrupts. E.g. ITE5570 device
found in ASUS TUF. Greater values may result in read failures. E.g. GXTP7863
device found on MateBookPro 2023.
Investigated by: huanghwh@gmail.com
PR: 289353
MFC after: 1 week
fixes: 36027361f9cf ("iichid: Stop using split I²C bus transactions")
| -rw-r--r-- | sys/dev/iicbus/iichid.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index fdb4816b8bd9..6d95d6d2d4f8 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -816,12 +816,13 @@ iichid_intr_setup(device_t dev, device_t child __unused, hid_intr_t intr, sc = device_get_softc(dev); /* - * Do not rely just on wMaxInputLength, as some devices (which?) - * may set it to a wrong length. Also find the longest input report - * in report descriptor, and add two for the length field. + * Start with wMaxInputLength to follow HID-over-I2C specs. Than if + * semi-HID device like ietp(4) requested changing of input buffer + * size with report descriptor overloading, find the longest input + * report in the descriptor, and add two for the length field. */ - rdesc->rdsize = 2 + - MAX(rdesc->isize, le16toh(sc->desc.wMaxInputLength)); + rdesc->rdsize = rdesc->rdsize == 0 ? + le16toh(sc->desc.wMaxInputLength) : rdesc->isize + 2; /* Write and get/set_report sizes are limited by I2C-HID protocol. */ rdesc->grsize = rdesc->srsize = IICHID_SIZE_MAX; rdesc->wrsize = IICHID_SIZE_MAX; |
