From nobody Tue Nov 26 10:48:05 2024 X-Original-To: dev-commits-src-all@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 4XyK6Z09YQz5fH8x; Tue, 26 Nov 2024 10:48:06 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XyK6Y6lfVz4tWH; Tue, 26 Nov 2024 10:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732618085; 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=UgTq4aze76CzVFgigYy1TsfTP1sZBBVvqUz91TOEVxk=; b=VsjFKvTj4J0p6upoiTaVOCOTo3m9tmgn1xRo+doROWCXOLrQ3OP3tmhpfSfvEyYqy1nikp W8WMEhTa6ln14yjQVdvwiv/Mz/j7x5oeQx3MnDQwjUa0M1ib/xlZGIP/7wU8DufQ6eiTJw N2DP1U5ks0C0AAxxpLiFaTfE+QXVd8oiSxRNHFuTuC54qoshocJlQ31OnAcnYy2sealUAX PUIwDDO31ZA8U8sGuTApED7VHlTd0JCezti7g0rn3U0PBy1zGu00RGeRCysW4ww++SdDB5 tmbVWKhPDPNa7KjtJ350rQdzV9VqPpiz9TT/AJTqFTnr0l2AFFnmGim1yiYboQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732618085; 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=UgTq4aze76CzVFgigYy1TsfTP1sZBBVvqUz91TOEVxk=; b=Dcms4ajQ8vDXvpTdEmtGISvHU/Fn+kCLvJsASA8D3NVoMmqQ7+VWWIWu2bMQEDMnghHP6T ulnOllJA8XbAZF90qvXSIGyR918KCFlYU8usevqaid7K7cu2SMInvu1Wss2mLizvug2VEH zFtXKLZRHTKBztkvl198VOBIJML5PwAwrpgNNnVIF5Ck/WAedYvBMJr4UXfv9xHiHNpGgA s8SkDNoer+2tPOfRSwoelFoD/TOXrnxcmzgSvmtmdZh1bkNHRDG2eF7ErOOUffVuRRgBd/ WF29AJ/GCqmmZkOhuSURW8AOjC398lMYKNmNzM+8PwmPbFbGze1f8n7+4QiPzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732618085; a=rsa-sha256; cv=none; b=m6UiHorV6JUU0ufWG36Nb8PJGV7/PyJPoQ2XcN7XjhcqlMHgzSQNvEmVYK3UqRHipDvs5e BU2hjbhrzJOIX0PkmYEnmdkgqHLw/Nh4GoeRfEVfvLW13noEcAUmgA/m9SCbryxXTrvSeB hoCKQaNa3rRzmLe+GROL5Bj8PTpgQ3Xc+Bf84oF3aEedVEzJmyoc5avJZUfd/H3RouipKr A7EduIq3PZjDbYb4op2gPb2LMc3BG9OB23pNyhfymMS5Fi1u77EpfEeD4r6fQVwR+fKlHw FNj/ODUzPbO4aiGLLdsma4QjYQi7yQxri9sz4Wr/6zw9dm8LREY0LOu6Iid+jw== 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 4XyK6Y6DDwzLjy; Tue, 26 Nov 2024 10:48:05 +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 4AQAm5SR036021; Tue, 26 Nov 2024 10:48:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AQAm5Xs036018; Tue, 26 Nov 2024 10:48:05 GMT (envelope-from git) Date: Tue, 26 Nov 2024 10:48:05 GMT Message-Id: <202411261048.4AQAm5Xs036018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: c0a5ee953f41 - main - hms(4): improve scroll with IICHID_SAMPLING List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0a5ee953f41905038aadba7b7d0df2af6612e71 Auto-Submitted: auto-generated The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c0a5ee953f41905038aadba7b7d0df2af6612e71 commit c0a5ee953f41905038aadba7b7d0df2af6612e71 Author: Edward Tomasz Napierala AuthorDate: 2024-11-25 15:08:10 +0000 Commit: Edward Tomasz Napierala CommitDate: 2024-11-26 10:28:51 +0000 hms(4): improve scroll with IICHID_SAMPLING The current quirk is designed to discard duplicated data read from the chip. Problem is, it also discards real events when they happen to be identical, which is the case with scroll wheel events; differently from X/Y they always move by fixed offset. This results in two-finger scroll that would stop mid-way that could be fixed by manually setting dev.hms.0.drift_thresh to 0. To fix that, don't discard duplicates when there's wheel movement. For users with actual duplicates problem this will result in scroll suddenly becoming quite inertial, but it will stop moving at any touch, so shouldn't be terrible. PR: kern/276709 Reviewed By: wulf Differential Revision: https://reviews.freebsd.org/D47640 --- sys/dev/hid/hms.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c index 0ac1b86c0735..dcb679407cca 100644 --- a/sys/dev/hid/hms.c +++ b/sys/dev/hid/hms.c @@ -122,6 +122,7 @@ struct hms_softc { hid_size_t isize; uint32_t drift_cnt; uint32_t drift_thresh; + struct hid_location wheel_loc; #endif }; @@ -131,6 +132,7 @@ hms_intr(void *context, void *buf, hid_size_t len) { struct hidmap *hm = context; struct hms_softc *sc = device_get_softc(hm->dev); + int32_t wheel; if (len > sc->isize) len = sc->isize; @@ -140,8 +142,18 @@ hms_intr(void *context, void *buf, hid_size_t len) * to return last report data in sampling mode even after touch has * been ended. That results in cursor drift. Filter out such a * reports through comparing with previous one. + * + * Except this results in dropping consecutive mouse wheel events, + * because differently from cursor movement they always move by the + * same amount. So, don't do it when there's mouse wheel movement. */ - if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0) { + if (sc->wheel_loc.size != 0) + wheel = hid_get_data(buf, len, &sc->wheel_loc); + else + wheel = 0; + + if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0 && + wheel == 0) { sc->drift_cnt++; if (sc->drift_thresh != 0 && sc->drift_cnt >= sc->drift_thresh) return; @@ -285,9 +297,25 @@ hms_attach(device_t dev) /* Count number of input usages of variable type mapped to buttons */ for (hi = sc->hm.hid_items; hi < sc->hm.hid_items + sc->hm.nhid_items; - hi++) + hi++) { if (hi->type == HIDMAP_TYPE_VARIABLE && hi->evtype == EV_KEY) nbuttons++; +#ifdef IICHID_SAMPLING + /* + * Make note of which part of the report descriptor is the wheel. + */ + if (hi->type == HIDMAP_TYPE_VARIABLE && + hi->evtype == EV_REL && hi->code == REL_WHEEL) { + sc->wheel_loc = hi->loc; + /* + * Account for the leading Report ID byte + * if it is a multi-report device. + */ + if (hi->id != 0) + sc->wheel_loc.pos += 8; + } +#endif + } /* announce information about the mouse */ device_printf(dev, "%d buttons and [%s%s%s%s%s] coordinates ID=%u\n",