git: 9d0404cfe92c - main - bcm5974(4): Do not handle pressure on non-ForceTouch devices

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sun, 12 Apr 2026 18:10:13 UTC
The branch main has been updated by wulf:

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

commit 9d0404cfe92c18b7697b3e4ad4a5790b12d2261e
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2026-04-12 18:09:23 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-04-12 18:09:23 +0000

    bcm5974(4): Do not handle pressure on non-ForceTouch devices
    
    They always report it value as zero breaking pressure-driven drivers
    like moused(8) and xf86-input-synaptics.
    
    MFC after:      1 week
---
 sys/dev/hid/bcm5974.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hid/bcm5974.c b/sys/dev/hid/bcm5974.c
index 7af6fbc24635..e2efeb08eb2e 100644
--- a/sys/dev/hid/bcm5974.c
+++ b/sys/dev/hid/bcm5974.c
@@ -120,6 +120,7 @@ enum tp_type {
 /* list of device capability bits */
 #define	HAS_INTEGRATED_BUTTON	1
 #define	USES_COMPACT_REPORT	2
+#define	SUPPORTS_FORCETOUCH	4
 
 struct tp_type_params {
 	uint8_t	caps;		/* device capability bitmask */
@@ -146,13 +147,13 @@ struct tp_type_params {
 		.delta = 0,
 	},
 	[TYPE4] = {
-		.caps = HAS_INTEGRATED_BUTTON,
+		.caps = HAS_INTEGRATED_BUTTON | SUPPORTS_FORCETOUCH,
 		.button = 31,
 		.offset = 23 * 2,
 		.delta = 2,
 	},
 	[TYPE_MT2U] = {
-		.caps = HAS_INTEGRATED_BUTTON | USES_COMPACT_REPORT,
+		.caps = HAS_INTEGRATED_BUTTON | USES_COMPACT_REPORT | SUPPORTS_FORCETOUCH,
 		.button = 1,
 		.offset = 12,
 		.delta = 0,
@@ -752,7 +753,8 @@ bcm5974_attach(device_t dev)
 	BCM5974_ABS(sc->sc_evdev, ABS_MT_POSITION_X, sc->sc_params->x);
 	BCM5974_ABS(sc->sc_evdev, ABS_MT_POSITION_Y, sc->sc_params->y);
 	/* finger pressure */
-	BCM5974_ABS(sc->sc_evdev, ABS_MT_PRESSURE, sc->sc_params->p);
+	if ((sc->sc_params->tp->caps & SUPPORTS_FORCETOUCH) != 0)
+		BCM5974_ABS(sc->sc_evdev, ABS_MT_PRESSURE, sc->sc_params->p);
 	/* finger touch area */
 	BCM5974_ABS(sc->sc_evdev, ABS_MT_TOUCH_MAJOR, sc->sc_params->w);
 	BCM5974_ABS(sc->sc_evdev, ABS_MT_TOUCH_MINOR, sc->sc_params->w);