diff options
-rw-r--r-- | sys/dev/i2c/ihidev.c | 19 | ||||
-rw-r--r-- | sys/dev/i2c/ihidev.h | 6 | ||||
-rw-r--r-- | sys/dev/i2c/imt.c | 14 |
3 files changed, 26 insertions, 13 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); diff --git a/sys/dev/i2c/ihidev.h b/sys/dev/i2c/ihidev.h index dde7cef5ab5..0404be65b06 100644 --- a/sys/dev/i2c/ihidev.h +++ b/sys/dev/i2c/ihidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.h,v 1.7 2019/07/22 14:37:06 jcs Exp $ */ +/* $OpenBSD: ihidev.h,v 1.8 2020/07/09 21:01:56 jcs Exp $ */ /* * HID-over-i2c driver * @@ -112,7 +112,9 @@ struct ihidev_attach_arg { struct i2c_attach_args *iaa; struct ihidev_softc *parent; uint8_t reportid; -#define IHIDEV_CLAIM_ALLREPORTID 255 + uint8_t claims[16]; + uint8_t nclaims; +#define IHIDEV_CLAIM_MULTIPLEID 255 }; struct i2c_hid_report_request { diff --git a/sys/dev/i2c/imt.c b/sys/dev/i2c/imt.c index 38169837338..5bd3894898f 100644 --- a/sys/dev/i2c/imt.c +++ b/sys/dev/i2c/imt.c @@ -1,9 +1,9 @@ -/* $OpenBSD: imt.c,v 1.4 2018/08/25 20:31:31 jcs Exp $ */ +/* $OpenBSD: imt.c,v 1.5 2020/07/09 21:01:56 jcs Exp $ */ /* * HID-over-i2c multitouch trackpad driver for devices conforming to * Windows Precision Touchpad standard * - * https://msdn.microsoft.com/en-us/library/windows/hardware/dn467314%28v=vs.85%29.aspx + * https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections * * Copyright (c) 2016 joshua stein <jcs@openbsd.org> * @@ -79,13 +79,19 @@ int imt_match(struct device *parent, void *match, void *aux) { struct ihidev_attach_arg *iha = (struct ihidev_attach_arg *)aux; + struct imt_softc sc; int size; void *desc; - if (iha->reportid == IHIDEV_CLAIM_ALLREPORTID) { + if (iha->reportid == IHIDEV_CLAIM_MULTIPLEID) { ihidev_get_report_desc(iha->parent, &desc, &size); - if (imt_find_winptp_reports(iha->parent, desc, size, NULL)) + if (imt_find_winptp_reports(iha->parent, desc, size, &sc)) { + iha->claims[0] = sc.sc_rep_input; + iha->claims[1] = sc.sc_rep_config; + iha->claims[2] = sc.sc_rep_cap; + iha->nclaims = 3; return (IMATCH_DEVCLASS_DEVSUBCLASS); + } } return (IMATCH_NONE); |