git: fbe17f9017e7 - main - evdev: Send first active rather than 0-th slot state as ST report

Vladimir Kondratyev wulf at FreeBSD.org
Tue Aug 24 23:04:14 UTC 2021


The branch main has been updated by wulf:

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

commit fbe17f9017e785dd564ce7fc5553a9136d3a0b03
Author:     Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2021-08-24 22:45:16 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-08-24 22:45:16 +0000

    evdev: Send first active rather than 0-th slot state as ST report
    
    MFC after:      2 weeks
---
 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 */


More information about the dev-commits-src-all mailing list