Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Sep 2021 00:02:24 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: f7d9821cdb06 - stable/13 - evdev: Send first active rather than 0-th slot state as ST report
Message-ID:  <202109080002.18802ORY050262@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=f7d9821cdb06604616a695ef2514116e5e0175d4

commit f7d9821cdb06604616a695ef2514116e5e0175d4
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-08-24 22:45:16 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-09-07 23:57:11 +0000

    evdev: Send first active rather than 0-th slot state as ST report
    
    (cherry picked from commit fbe17f9017e785dd564ce7fc5553a9136d3a0b03)
---
 sys/dev/evdev/evdev_mt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c
index a28b034884ba..0ededf053f36 100644
--- a/sys/dev/evdev/evdev_mt.c
+++ b/sys/dev/evdev/evdev_mt.c
@@ -205,20 +205,21 @@ static void
 evdev_mt_send_st_compat(struct evdev_dev *evdev)
 {
 	struct evdev_mt *mt = evdev->ev_mt;
-	int nfingers, i;
+	int nfingers, i, st_slot;
 
 	EVDEV_LOCK_ASSERT(evdev);
 
 	nfingers = bitcount(mt->touches);
 	evdev_send_event(evdev, EV_KEY, BTN_TOUCH, nfingers > 0);
 
-	if ((mt->touches & 1U << 0) != 0)
-		/* Echo 0-th MT-slot as ST-slot */
+	/* Send first active MT-slot state as single touch report */
+	st_slot = ffs(mt->touches) - 1;
+	if (st_slot != -1)
 		for (i = 0; i < nitems(evdev_mtstmap); i++)
 			if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][1]))
 				evdev_send_event(evdev, EV_ABS,
 				    evdev_mtstmap[i][1],
-				    evdev_mt_get_value(evdev, 0,
+				    evdev_mt_get_value(evdev, st_slot,
 				    evdev_mtstmap[i][0]));
 
 	/* Touchscreens should not report tool taps */



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