summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoshua Stein <jcs@cvs.openbsd.org>2021-08-26 21:05:02 +0000
committerJoshua Stein <jcs@cvs.openbsd.org>2021-08-26 21:05:02 +0000
commit15d6014ffacb73e786c337fe4969519351f35779 (patch)
treee4de5359eef5d51e83bcd8df6159393ee544d71d /sys/dev
parent324c91be36e046bfd1ac94bc864654d6de6a9bc7 (diff)
Request wMaxInputLength bytes of data on each interrupt which should
already account for the two-byte length and one-byte report id, rather than adding them ourself and requesting wMaxInputLength + 3. Fixes dwiic timeouts requesting data from at least one touchpad. Tested by various
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2c/ihidev.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index 07e7b86fae5..8fefab14f21 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.23 2020/07/09 21:01:55 jcs Exp $ */
+/* $OpenBSD: ihidev.c,v 1.24 2021/08/26 21:05:01 jcs Exp $ */
/*
* HID-over-i2c driver
*
@@ -106,7 +106,6 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
struct device *dev;
int repid, repsz;
int repsizes[256];
- int isize;
sc->sc_tag = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
@@ -158,12 +157,8 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
repsz = hid_report_size(sc->sc_report, sc->sc_reportlen,
hid_input, repid);
repsizes[repid] = repsz;
-
- isize = repsz + 2; /* two bytes for the length */
- isize += (sc->sc_nrepid != 1); /* one byte for the report ID */
- if (isize > sc->sc_isize)
- sc->sc_isize = isize;
-
+ if (repsz > sc->sc_isize)
+ sc->sc_isize = repsz;
if (repsz != 0)
DPRINTF(("%s: repid %d size %d\n", sc->sc_dev.dv_xname,
repid, repsz));
@@ -648,7 +643,7 @@ ihidev_intr(void *arg)
iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0,
- sc->sc_ibuf, sc->sc_isize, I2C_F_POLL);
+ sc->sc_ibuf, letoh16(sc->hid_desc.wMaxInputLength), I2C_F_POLL);
iic_release_bus(sc->sc_tag, I2C_F_POLL);
/*