git: 8f496952e3e6 - main - iichid(4): Always use wMaxInputLength bytes as input report length
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Sep 2025 08:38:15 UTC
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8f496952e3e6cdd531675a44b84b3f1954532afb commit 8f496952e3e6cdd531675a44b84b3f1954532afb Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2025-09-22 08:37:19 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2025-09-22 08:37:19 +0000 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") --- sys/dev/iicbus/iichid.c | 11 ++++++----- 1 file 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;