From nobody Mon Sep 22 08:38:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cVc2J01Myz68pC9; Mon, 22 Sep 2025 08:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cVc2H6Y6Jz3sNR; Mon, 22 Sep 2025 08:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758530295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JHY7JYjx9HV0S479Tr2vk2gGiblDZf9yHuNBt3cpHsU=; b=tIlQUvpCmeFa0pZP/T2R308NWsofrgHjGWLU+Mm5iwHhJLa2kDcnFdXXuqAvAuZsSAW9ye VFy6aK7HUJChBBwCrWNMV8k09aTY/Inx0B8WwUgdy41LZdzdqnpiSAlCPtVXoDuF/XpHyn VE8i9xa37qI9FxPjGz7mFRw+4CR8NYUpx+dnUg77BDjcfrvOgrhehRWEx4grdphQ3KHnFN DfenRLG9oAO0/kNZfCapVktDBy4Yyzd137fRUlg+zbdBoKHofkfYrE8ZsKcynYfULYQlnw iU/ob0ZGif2H5xiUYTQwafcUxua7R2tfljwYBvUwkSZukRN932VkwXrvshkJ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758530295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JHY7JYjx9HV0S479Tr2vk2gGiblDZf9yHuNBt3cpHsU=; b=msipV0k+vKbJFyYI3EgaSR+u5MHjeHnX780Fg8CJfZLPZkSvC1Ym8amdMSbQjq/JyqcLH4 fG7OHnjOiMKC7MsA+EA5UtDyBROGzoKFLQdpOUKBUIV+zF+NgIdgW9OmOhR3jmABGtJMJ7 DVFFhkGUY41DYOXsCENlEE1xy0AacFEyhoC4/ms7a66jETH3chtRlcg2mgrQgWF4jTY++K IP7FJDd1bfswtPtR58PbORB+Pf6x5o9UQSnBzxqRes5HHgnGL7+O0u8li9aD2KdyvRjDX/ LxRk6rLB6uWrZ12HovmUg0fW45QP2bB0XiKyMQmHCXmiGgSDQQgT40yfE+CQRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758530295; a=rsa-sha256; cv=none; b=yvHsoKkA4WD+wbp3+dKA8vEBCuGXIG/y1RcaTJYHG3iGA5KkwV93U6D1+ohv+x6BtBiyX7 C+CvCZl9qS1dE9GZNFzGmin9dCZKrTD8ZuiYAAAAa7pI/A6k7bYFGKbhlOCFhpi5EzuqAT EX1qY+rSCIsuUwo2yLbVKM74vJe7jZgSJIW1IpDXFW+RzsMPh/uiPbBWp/ov46WqptIn3+ Fy0hJaJLj70trfMkM2YsJF19fAc9yXuuPMjmiwRolF+TIzTq6fTGZKHMwnkjagvW4BokFD MiTe5sGdmTynqmghdtiO3sxRkZaLR78YDmpsLV7wI0vpziLj5s/QoTsEFlUvfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cVc2H5PXZzsxr; Mon, 22 Sep 2025 08:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58M8cFvc006080; Mon, 22 Sep 2025 08:38:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58M8cFGA006077; Mon, 22 Sep 2025 08:38:15 GMT (envelope-from git) Date: Mon, 22 Sep 2025 08:38:15 GMT Message-Id: <202509220838.58M8cFGA006077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 8f496952e3e6 - main - iichid(4): Always use wMaxInputLength bytes as input report length List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f496952e3e6cdd531675a44b84b3f1954532afb Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8f496952e3e6cdd531675a44b84b3f1954532afb commit 8f496952e3e6cdd531675a44b84b3f1954532afb Author: Vladimir Kondratyev AuthorDate: 2025-09-22 08:37:19 +0000 Commit: Vladimir Kondratyev 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;