summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/ihidev.c
diff options
context:
space:
mode:
authorJoshua Stein <jcs@cvs.openbsd.org>2020-07-09 21:01:57 +0000
committerJoshua Stein <jcs@cvs.openbsd.org>2020-07-09 21:01:57 +0000
commitf35a7bb2867b090562f72803b48926c29ace0bee (patch)
tree42f41219e5461b50ab551b2637bfb4f02d415c20 /sys/dev/i2c/ihidev.c
parentfdfd7463ed686da056bc94cbdcdb2515d756ee94 (diff)
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);