Module Name:    src
Committed By:   skrll
Date:           Sat Sep  7 16:39:15 UTC 2013

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

Log Message:
Reload the full device descriptor after re-establishing the default pipe
with the new address.

Some HCDs, e.g. dwc2, need wMaxPacketSize to be the value returned from
the device to complete transfers after the set address.  Opening the pipe
again gives the HCD access to the correct value.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/dev/usb/usb_subr.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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.191 src/sys/dev/usb/usb_subr.c:1.192
--- src/sys/dev/usb/usb_subr.c:1.191	Wed Aug 21 17:59:40 2013
+++ src/sys/dev/usb/usb_subr.c	Sat Sep  7 16:39:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.191 2013/08/21 17:59:40 jakllsch Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.192 2013/09/07 16:39:15 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.191 2013/08/21 17:59:40 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.192 2013/09/07 16:39:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1253,14 +1253,6 @@ usbd_new_device(device_t parent, usbd_bu
 	dev->address = addr;	/* new device address now */
 	bus->devices[addr] = dev;
 
-	err = usbd_reload_device_desc(dev);
-	if (err) {
-		DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc "
-			      "failed\n", addr));
-		usbd_remove_device(dev, up);
-		return (err);
-	}
-
 	/* Re-establish the default pipe with the new address. */
 	usbd_kill_pipe(dev->default_pipe);
 	err = usbd_setup_pipe_flags(dev, 0, &dev->def_ep, USBD_DEFAULT_INTERVAL,
@@ -1271,6 +1263,14 @@ usbd_new_device(device_t parent, usbd_bu
 		return err;
 	}
 
+	err = usbd_reload_device_desc(dev);
+	if (err) {
+		DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc "
+			      "failed\n", addr));
+		usbd_remove_device(dev, up);
+		return (err);
+	}
+
 	/* Assume 100mA bus powered for now. Changed when configured. */
 	dev->power = USB_MIN_POWER;
 	dev->self_powered = 0;

Reply via email to