Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 2021 22:26:12 GMT
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5517f7f9e70d - stable/13 - hmt(4): Store Contact Count in separate variable.
Message-ID:  <202108232226.17NMQCbB014677@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=5517f7f9e70dcfdb824ce414e4a0f5a24f58fefe

commit 5517f7f9e70dcfdb824ce414e4a0f5a24f58fefe
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-08-16 20:11:36 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-08-23 22:19:43 +0000

    hmt(4): Store Contact Count in separate variable.
    
    No functional changes.
    
    (cherry picked from commit 95add157e341f2c1ce47eaa19b3c5771705ea20d)
---
 sys/dev/hid/hmt.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c
index fd50ea4de829..2eb02811a5a4 100644
--- a/sys/dev/hid/hmt.c
+++ b/sys/dev/hid/hmt.c
@@ -185,6 +185,7 @@ struct hmt_softc {
 	device_t		dev;
 	enum hmt_type		type;
 
+	int32_t			cont_count_max;
 	struct hid_absinfo	ai[HMT_N_USAGES];
 	struct hid_location	locs[MAX_MT_SLOTS][HMT_N_USAGES];
 	struct hid_location	cont_count_loc;
@@ -332,7 +333,7 @@ hmt_attach(device_t dev)
 			 * 'Contact Count Maximum'
 			 */
 			if (cont_count_max > 0)
-				sc->ai[HMT_SLOT].max = cont_count_max - 1;
+				sc->cont_count_max = cont_count_max;
 		} else
 			DPRINTF("hid_get_report error=%d\n", err);
 	} else
@@ -368,12 +369,19 @@ hmt_attach(device_t dev)
 	}
 
 	/* Cap contact count maximum to MAX_MT_SLOTS */
-	if (sc->ai[HMT_SLOT].max >= MAX_MT_SLOTS) {
+	if (sc->cont_count_max > MAX_MT_SLOTS) {
 		DPRINTF("Hardware reported %d contacts while only %d is "
-		    "supported\n", (int)sc->ai[HMT_SLOT].max+1, MAX_MT_SLOTS);
-		sc->ai[HMT_SLOT].max = MAX_MT_SLOTS - 1;
+		    "supported\n", sc->cont_count_max, MAX_MT_SLOTS);
+		sc->cont_count_max = MAX_MT_SLOTS;
 	}
 
+	/* Set number of MT protocol type B slots */
+	sc->ai[HMT_SLOT] = (struct hid_absinfo) {
+		.min = 0,
+		.max = sc->cont_count_max - 1,
+		.res = 0,
+	};
+
 	if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)
 		sc->do_timestamps = true;
 #ifdef IICHID_SAMPLING
@@ -445,7 +453,7 @@ hmt_attach(device_t dev)
 	    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->ai[HMT_SLOT].max + 1,
+	    (int)sc->cont_count_max,
 	    isset(sc->caps, HMT_IN_RANGE) ? "R" : "",
 	    isset(sc->caps, HMT_CONFIDENCE) ? "C" : "",
 	    isset(sc->caps, HMT_WIDTH) ? "W" : "",
@@ -834,13 +842,6 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len,
 	if (cont_count_max < 1)
 		cont_count_max = cont;
 
-	/* Set number of MT protocol type B slots */
-	sc->ai[HMT_SLOT] = (struct hid_absinfo) {
-		.min = 0,
-		.max = cont_count_max - 1,
-		.res = 0,
-	};
-
 	/* Report touch orientation if both width and height are supported */
 	if (isset(sc->caps, HMT_WIDTH) && isset(sc->caps, HMT_HEIGHT)) {
 		setbit(sc->caps, HMT_ORIENTATION);
@@ -857,6 +858,7 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len,
 		    hid_feature, sc->thqa_cert_rid);
 
 	sc->report_id = report_id;
+	sc->cont_count_max = cont_count_max;
 	sc->nconts_per_report = cont;
 	sc->has_int_button = has_int_button;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108232226.17NMQCbB014677>