From owner-dev-commits-src-branches@freebsd.org Tue Sep 21 23:43:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B686267F5F7; Tue, 21 Sep 2021 23:43:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDdKq4GJMz4q6t; Tue, 21 Sep 2021 23:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6A8BB580E; Tue, 21 Sep 2021 23:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LNhh1T047990; Tue, 21 Sep 2021 23:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhhS0047989; Tue, 21 Sep 2021 23:43:43 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:43 GMT Message-Id: <202109212343.18LNhhS0047989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 12061cf60579 - stable/13 - hmt(4): Add support for serial packet reporting mode 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 12061cf605795036a43d9d72be4aef4650b425d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:43 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=12061cf605795036a43d9d72be4aef4650b425d9 commit 12061cf605795036a43d9d72be4aef4650b425d9 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:31:17 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:39:58 +0000 hmt(4): Add support for serial packet reporting mode In Serial mode, each packet contains information that describes a single physical contact point. Multiple contacts are streamed serially. In this mode, devices report all contact information in a series of packets. The device sends a separate packet for each concurrent contact. Serial packet reporting mode is used by post-2014 eGalax touchscreens. Tested by: Mark Kane (cherry picked from commit 0075742d1834d52b5e24a606aca63ad7e67e81f3) --- sys/dev/hid/hmt.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index d1b36c424ba8..cb7afe7290d0 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -204,6 +204,8 @@ struct hmt_softc { uint8_t report_id; uint32_t max_button; bool has_int_button; + bool has_cont_count; + bool has_scan_time; bool is_clickpad; bool do_timestamps; #ifdef IICHID_SAMPLING @@ -371,7 +373,8 @@ hmt_attach(device_t dev) sc->cont_count_max = MAX_MT_SLOTS; } - if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) + if (sc->has_scan_time && + (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)) sc->do_timestamps = true; #ifdef IICHID_SAMPLING if (hid_test_quirk(hw, HQ_IICHID_SAMPLING)) @@ -438,13 +441,14 @@ hmt_attach(device_t dev) } /* Announce information about the touch device */ - device_printf(sc->dev, "Multitouch %s with %d external button%s%s\n", + device_printf(sc->dev, "%s %s with %d external button%s%s\n", + sc->cont_count_max > 1 ? "Multitouch" : "Singletouch", sc->type == HMT_TYPE_TOUCHSCREEN ? "touchscreen" : "touchpad", nbuttons, nbuttons != 1 ? "s" : "", sc->is_clickpad ? ", click-pad" : ""); device_printf(sc->dev, - "%d contacts with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", - (int)sc->cont_count_max, + "%d contact%s with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", + (int)sc->cont_count_max, sc->cont_count_max != 1 ? "s" : "", isset(sc->caps, HMT_IN_RANGE) ? "R" : "", isset(sc->caps, HMT_CONFIDENCE) ? "C" : "", isset(sc->caps, HMT_WIDTH) ? "W" : "", @@ -513,6 +517,12 @@ hmt_intr(void *context, void *buf, hid_size_t len) } /* + * "In Serial mode, each packet contains information that describes a + * single physical contact point. Multiple contacts are streamed + * serially. In this mode, devices report all contact information in a + * series of packets. The device sends a separate packet for each + * concurrent contact." + * * "In Parallel mode, devices report all contact information in a * single packet. Each physical contact is represented by a logical * collection that is embedded in the top-level collection." @@ -521,7 +531,10 @@ hmt_intr(void *context, void *buf, hid_size_t len) * report with contactid=0 but contactids are zero-based, find * contactcount first. */ - cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + if (sc->has_cont_count) + cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + else + cont_count = 1; /* * "In Hybrid mode, the number of contacts that can be reported in one * report is less than the maximum number of contacts that the device @@ -753,7 +766,6 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->cont_count_loc = hi.loc; break; } - /* Scan time is required but clobbered by evdev */ if (hi.collevel == 1 && hi.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_SCAN_TIME)) { scan_time_found = true; @@ -804,7 +816,7 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, hid_end_parse(hd); /* Check for required HID Usages */ - if (!cont_count_found || !scan_time_found || cont == 0) + if ((!cont_count_found && cont != 1) || cont == 0) return (HMT_TYPE_UNSUPPORTED); for (i = 0; i < HMT_N_USAGES; i++) { if (hmt_hid_map[i].required && isclr(sc->caps, i)) @@ -842,6 +854,8 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->cont_count_max = cont_count_max; sc->nconts_per_report = cont; sc->has_int_button = has_int_button; + sc->has_cont_count = cont_count_found; + sc->has_scan_time = scan_time_found; return (type); }