summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-06-26 11:17:35 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-06-26 11:17:35 +0000
commit395c94be081c70bb2a4b36bacdef46669bbc98fa (patch)
tree66ab61ebe7a2466c3f845acd797aca6302f18626 /sys/dev
parent60e3bdcff00ab25522278019f67334f3161390ad (diff)
Revert previous. uvideo checks the transfered length of every frame and
this break some devices. As found the hardway by Hugo Sastre via sobrado@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/dwc2/dwc2.c10
-rw-r--r--sys/dev/usb/ehci.c4
-rw-r--r--sys/dev/usb/ohci.c15
-rw-r--r--sys/dev/usb/uhci.c3
4 files changed, 21 insertions, 11 deletions
diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c
index f6d5ecca661..3414b2d6220 100644
--- a/sys/dev/usb/dwc2/dwc2.c
+++ b/sys/dev/usb/dwc2/dwc2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.c,v 1.29 2015/06/22 12:56:55 mpi Exp $ */
+/* $OpenBSD: dwc2.c,v 1.30 2015/06/26 11:17:34 mpi Exp $ */
/* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */
/*-
@@ -1771,14 +1771,14 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
}
if (xfertype == UE_ISOCHRONOUS) {
- uint32_t len;
int i;
xfer->actlen = 0;
for (i = 0; i < xfer->nframes; ++i) {
- len = dwc2_hcd_urb_get_iso_desc_actual_length(qtd->urb,
- i);
- xfer->actlen += len;
+ xfer->frlengths[i] =
+ dwc2_hcd_urb_get_iso_desc_actual_length(
+ qtd->urb, i);
+ xfer->actlen += xfer->frlengths[i];
}
}
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 0672d7b5e7a..32f4fe4ccf7 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.186 2015/06/22 12:56:55 mpi Exp $ */
+/* $OpenBSD: ehci.c,v 1.187 2015/06/26 11:17:34 mpi Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -825,6 +825,7 @@ ehci_isoc_idone(struct usbd_xfer *xfer)
if (EHCI_ITD_GET_STATUS(status) != 0)
len = 0; /*No valid data on error*/
+ xfer->frlengths[nframes++] = len;
actlen += len;
}
}
@@ -842,6 +843,7 @@ ehci_isoc_idone(struct usbd_xfer *xfer)
else
len = 0;
+ xfer->frlengths[nframes++] = len;
actlen += len;
}
}
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index ababa51bdbe..d92e63f4187 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.144 2015/06/22 12:56:55 mpi Exp $ */
+/* $OpenBSD: ohci.c,v 1.145 2015/06/26 11:17:34 mpi Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -1218,7 +1218,7 @@ ohci_softintr(void *v)
struct usbd_xfer *xfer;
struct ohci_pipe *opipe;
int len, cc, s;
- int i, j, actlen, iframes;
+ int i, j, actlen, iframes, uedir;
DPRINTFN(10,("ohci_softintr: enter\n"));
@@ -1351,6 +1351,8 @@ ohci_softintr(void *v)
opipe = (struct ohci_pipe *)xfer->pipe;
opipe->u.iso.inuse -= xfer->nframes;
+ uedir = UE_GET_DIR(xfer->pipe->endpoint->edesc->
+ bEndpointAddress);
xfer->status = USBD_NORMAL_COMPLETION;
actlen = 0;
for (i = 0, sitd = xfer->hcpriv; ;
@@ -1359,7 +1361,10 @@ ohci_softintr(void *v)
if (OHCI_ITD_GET_CC(letoh32(sitd->
itd.itd_flags)) != OHCI_CC_NO_ERROR)
xfer->status = USBD_IOERROR;
- if (xfer->status == USBD_NORMAL_COMPLETION) {
+ /* For input, update frlengths with actual */
+ /* XXX anything necessary for output? */
+ if (uedir == UE_DIR_IN &&
+ xfer->status == USBD_NORMAL_COMPLETION) {
iframes = OHCI_ITD_GET_FC(letoh32(
sitd->itd.itd_flags));
for (j = 0; j < iframes; i++, j++) {
@@ -1371,6 +1376,7 @@ ohci_softintr(void *v)
len = 0;
else
len = OHCI_ITD_PSW_LENGTH(len);
+ xfer->frlengths[i] = len;
actlen += len;
}
}
@@ -1379,7 +1385,8 @@ ohci_softintr(void *v)
ohci_free_sitd(sc, sitd);
}
ohci_free_sitd(sc, sitd);
- if (xfer->status == USBD_NORMAL_COMPLETION)
+ if (uedir == UE_DIR_IN &&
+ xfer->status == USBD_NORMAL_COMPLETION)
xfer->actlen = actlen;
xfer->hcpriv = NULL;
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index b18f9590a28..01437345118 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.137 2015/06/22 12:56:55 mpi Exp $ */
+/* $OpenBSD: uhci.c,v 1.138 2015/06/26 11:17:34 mpi Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -1234,6 +1234,7 @@ uhci_idone(struct usbd_xfer *xfer)
n = 0;
status = letoh32(std->td.td_status);
len = UHCI_TD_GET_ACTLEN(status);
+ xfer->frlengths[i] = len;
actlen += len;
}
upipe->u.iso.inuse -= nframes;