diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-28 08:42:42 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-28 08:42:42 +0000 |
commit | b1bc980a2585eeb02d084131b8777c559309c6e4 (patch) | |
tree | 5fd6c29e57147acdca1fb965d2fa8cbdbd58ec6a | |
parent | 5d45999f4f19c5b8bc15659156983e25e247a98b (diff) |
Fix uhidev_get_report_async() from David Higgs.
-rw-r--r-- | sys/dev/usb/uhidev.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 27e1e60de68..a9613a6ce7f 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.69 2015/01/22 10:27:47 mpi Exp $ */ +/* $OpenBSD: uhidev.c,v 1.70 2015/02/28 08:42:41 mpi Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -53,6 +53,7 @@ #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> #include <dev/usb/usbdivar.h> +#include <dev/usb/usb_mem.h> #include <dev/usb/hid.h> #include <dev/usb/usb_quirks.h> @@ -747,15 +748,17 @@ void uhidev_get_report_async_cb(struct usbd_xfer *xfer, void *priv, usbd_status err) { struct uhidev_async_info *info = priv; + char *buf; int len = -1; if (err == USBD_NORMAL_COMPLETION || err == USBD_SHORT_XFER) { len = xfer->actlen; + buf = KERNADDR(&xfer->dmabuf, 0); if (info->id > 0) { len--; - memcpy(info->data, xfer->buffer + 1, len); + memcpy(info->data, buf + 1, len); } else { - memcpy(info->data, xfer->buffer, len); + memcpy(info->data, buf, len); } } info->callback(info->priv, info->id, info->data, len); @@ -803,7 +806,7 @@ uhidev_get_report_async(struct uhidev_softc *sc, int type, int id, void *data, USETW(req.wIndex, sc->sc_ifaceno); USETW(req.wLength, len); - if (usbd_request_async(xfer, &req, priv, uhidev_get_report_async_cb)) { + if (usbd_request_async(xfer, &req, info, uhidev_get_report_async_cb)) { free(info, M_TEMP, sizeof(*info)); actlen = -1; } |