Module Name:    src
Committed By:   skrll
Date:           Tue Dec 22 22:26:16 UTC 2015

Modified Files:
        src/sys/dev/usb: usbdi.c

Log Message:
In usbd_transfer deal with errors from the HCD transfer (and start)
methods properly by removing the failed xfer from the pipe queue.

For example, an Apple keyboard and FS hub with attached ums(4) on
dwctwo(4) (rpo0/rpi model a) needs this fix otherwise probing
usbd_new_device will never complete after first failed attempt to get
the initial device descriptor.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/usbdi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.167 src/sys/dev/usb/usbdi.c:1.168
--- src/sys/dev/usb/usbdi.c:1.167	Tue Dec 22 15:12:39 2015
+++ src/sys/dev/usb/usbdi.c	Tue Dec 22 22:26:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.167 2015/12/22 15:12:39 skrll Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.168 2015/12/22 22:26:16 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.167 2015/12/22 15:12:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.168 2015/12/22 22:26:16 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -323,6 +323,15 @@ usbd_transfer(usbd_xfer_handle xfer)
 			bus->methods->freem(bus, &xfer->dmabuf);
 			xfer->rqflags &= ~URQ_AUTO_DMABUF;
 		}
+		/*
+		 * The transfer made it onto the pipe queue, but didn't get
+		 * accepted by the HCD for some reason.  It needs removing
+		 * from the pipe queue.
+		 */
+		usbd_lock_pipe(pipe);
+		SIMPLEQ_REMOVE_HEAD(&pipe->queue, next);
+		usbd_start_next(pipe);
+		usbd_unlock_pipe(pipe);
 	}
 
 	if (!(flags & USBD_SYNCHRONOUS)) {

Reply via email to