hmt: Allow I2C sampling mode support to be compiled out.

This commit is contained in:
Vladimir Kondratyev 2021-01-20 23:10:07 +03:00
parent 3e954a8bc6
commit 5cc21ab994
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -4,6 +4,7 @@
KMOD= hmt
SRCS= hmt.c
SRCS+= opt_hid.h
SRCS+= bus_if.h device_if.h
.include <bsd.kmod.mk>