summaryrefslogtreecommitdiffstats
path: root/sys/dev/i2c/ihidev.c
diff options
context:
space:
mode:
authorjcs <jcs@openbsd.org>2020-07-09 21:01:55 +0000
committerjcs <jcs@openbsd.org>2020-07-09 21:01:55 +0000
commit8fabbf99b406209dfff93615e906d9d6117e312a (patch)
tree80b945c20424c017dcf12d7614b3d6a783fbac8d /sys/dev/i2c/ihidev.c
parentSome touchpads don't have the "maximum number of contacts" or (diff)
downloadwireguard-openbsd-8fabbf99b406209dfff93615e906d9d6117e312a.tar.xz
wireguard-openbsd-8fabbf99b406209dfff93615e906d9d6117e312a.zip
On some laptops that have a Windows Precision Touchpad (imt) and
also a trackstick or separate physical buttons, imt was claiming all report ids of the ihidev device preventing the trackstick/buttons from attaching as a separate ims device on other report ids. Just claim the report ids that imt needs and let ims attach to others it may find. Fixes two Dell Latitude laptops and tested in snaps for a bit.
Diffstat (limited to 'sys/dev/i2c/ihidev.c')
-rw-r--r--sys/dev/i2c/ihidev.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index 4c63eb5bae2..07e7b86fae5 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.22 2020/01/24 04:03:11 cheloha Exp $ */
+/* $OpenBSD: ihidev.c,v 1.23 2020/07/09 21:01:55 jcs Exp $ */
/*
* HID-over-i2c driver
*
@@ -173,17 +173,22 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
iha.iaa = ia;
iha.parent = sc;
- /* Look for a driver claiming all report IDs first. */
- iha.reportid = IHIDEV_CLAIM_ALLREPORTID;
+ /* Look for a driver claiming multiple report IDs first. */
+ iha.reportid = IHIDEV_CLAIM_MULTIPLEID;
+ iha.nclaims = 0;
dev = config_found_sm((struct device *)sc, &iha, NULL,
ihidev_submatch);
if (dev != NULL) {
- for (repid = 0; repid < sc->sc_nrepid; repid++)
- sc->sc_subdevs[repid] = (struct ihidev *)dev;
- return;
+ for (repid = 0; repid < iha.nclaims; repid++) {
+ sc->sc_subdevs[iha.claims[repid]] =
+ (struct ihidev *)dev;
+ }
}
for (repid = 0; repid < sc->sc_nrepid; repid++) {
+ if (sc->sc_subdevs[repid] != NULL)
+ continue;
+
if (hid_report_size(sc->sc_report, sc->sc_reportlen, hid_input,
repid) == 0 &&
hid_report_size(sc->sc_report, sc->sc_reportlen,
@@ -748,7 +753,7 @@ ihidev_print(void *aux, const char *pnp)
if (pnp)
printf("hid at %s", pnp);
- if (iha->reportid != 0 && iha->reportid != IHIDEV_CLAIM_ALLREPORTID)
+ if (iha->reportid != 0)
printf(" reportid %d", iha->reportid);
return (UNCONF);