git: 5cc21ab9949a - main - hmt: Allow I2C sampling mode support to be compiled out.

Vladimir Kondratyev wulf at FreeBSD.org
Wed Jan 20 20:10:46 UTC 2021


The branch main has been updated by wulf:

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

commit 5cc21ab9949a189c809285823dbb6eadde6c6864
Author:     Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2021-01-20 20:10:07 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-01-20 20:10:07 +0000

    hmt: Allow I2C sampling mode support to be compiled out.
---
 sys/dev/hid/hmt.c            | 10 ++++++++++
 sys/modules/hid/hmt/Makefile |  1 +
 2 files changed, 11 insertions(+)

diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c
index 6cfe43157e64..fd50ea4de829 100644
--- a/sys/dev/hid/hmt.c
+++ b/sys/dev/hid/hmt.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
  * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
  */
 
+#include "opt_hid.h"
+
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/kernel.h>
@@ -207,7 +209,9 @@ struct hmt_softc {
 	bool			has_int_button;
 	bool			is_clickpad;
 	bool			do_timestamps;
+#ifdef IICHID_SAMPLING
 	bool			iichid_sampling;
+#endif
 
 	struct hid_location	cont_max_loc;
 	uint32_t		cont_max_rlen;
@@ -372,8 +376,10 @@ hmt_attach(device_t dev)
 
 	if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)
 		sc->do_timestamps = true;
+#ifdef IICHID_SAMPLING
 	if (hid_test_quirk(hw, HQ_IICHID_SAMPLING))
 		sc->iichid_sampling = true;
+#endif
 
 	hidbus_set_intr(dev, hmt_intr, sc);
 
@@ -404,8 +410,10 @@ hmt_attach(device_t dev)
 		evdev_support_event(sc->evdev, EV_MSC);
 		evdev_support_msc(sc->evdev, MSC_TIMESTAMP);
 	}
+#ifdef IICHID_SAMPLING
 	if (sc->iichid_sampling)
 		evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_AUTOREL);
+#endif
 	nbuttons = 0;
 	if (sc->max_button != 0 || sc->has_int_button) {
 		evdev_support_event(sc->evdev, EV_KEY);
@@ -476,6 +484,7 @@ hmt_intr(void *context, void *buf, hid_size_t len)
 	int32_t delta;
 	uint8_t id;
 
+#ifdef IICHID_SAMPLING
 	/*
 	 * Special packet of zero length is generated by iichid driver running
 	 * in polling mode at the start of inactivity period to workaround
@@ -492,6 +501,7 @@ hmt_intr(void *context, void *buf, hid_size_t len)
 		evdev_sync(sc->evdev);
 		return;
 	}
+#endif
 
 	/* Ignore irrelevant reports */
 	id = sc->report_id != 0 ? *(uint8_t *)buf : 0;
diff --git a/sys/modules/hid/hmt/Makefile b/sys/modules/hid/hmt/Makefile
index f6bed08d439d..975c94fa0b88 100644
--- a/sys/modules/hid/hmt/Makefile
+++ b/sys/modules/hid/hmt/Makefile
@@ -4,6 +4,7 @@
 
 KMOD=	hmt
 SRCS=	hmt.c
+SRCS+=	opt_hid.h
 SRCS+=	bus_if.h device_if.h
 
 .include <bsd.kmod.mk>


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