[patch 4/7] wusb: devices dont use a set address

Inaky Perez-Gonzalez <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.linux.drivers.uwb
Message-ID <[email protected]>
wusb-devices-dont-use-a-set-address.patch (text/plain, 2.7 KB)
A WUSB device gets his address during the connection phase; later on,
during the authenthication phase (driven from user space) we assign
the final address. So we need to skip in hub_port_init() the actual
setting of the address for WUSB devices.

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>


Index: linux.hg/drivers/usb/core/hub.c
===================================================================
--- linux.hg.orig/drivers/usb/core/hub.c	2007-07-31 19:25:59.000000000 -0700
+++ linux.hg/drivers/usb/core/hub.c	2007-07-31 19:27:52.000000000 -0700
@@ -2336,27 +2336,33 @@
 			}
 #undef GET_DESCRIPTOR_BUFSIZE
 		}
+		/*
+		 * If device is WUSB, we already assigned an
+		 * unauthorized address in the Connect Ack sequence;
+		 * authorization will assign the final address.
+		 */
+		if (udev->wusb == 0) {
+			for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
+				retval = hub_set_address(udev);
+				if (retval >= 0)
+					break;
+				msleep(200);
+			}
+			if (retval < 0) {
+				dev_err(&udev->dev,
+					"device not accepting address %d, error %d\n",
+					udev->devnum, retval);
+				goto fail;
+			}
 
-		for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
-			retval = hub_set_address(udev);
-			if (retval >= 0)
+			/* cope with hardware quirkiness:
+			 *  - let SET_ADDRESS settle, some device hardware wants it
+			 *  - read ep0 maxpacket even for high and low speed,
+			 */
+			msleep(10);
+			if (USE_NEW_SCHEME(retry_counter))
 				break;
-			msleep(200);
 		}
-		if (retval < 0) {
-			dev_err(&udev->dev,
-				"device not accepting address %d, error %d\n",
-				udev->devnum, retval);
-			goto fail;
-		}
- 
-		/* cope with hardware quirkiness:
-		 *  - let SET_ADDRESS settle, some device hardware wants it
-		 *  - read ep0 maxpacket even for high and low speed,
-  		 */
-		msleep(10);
-		if (USE_NEW_SCHEME(retry_counter))
-			break;
 
 		retval = usb_get_device_descriptor(udev, 8);
 		if (retval < 8) {
@@ -2373,7 +2379,7 @@
 	if (retval)
 		goto fail;
 
-	i = udev->descriptor.bMaxPacketSize0 == 0xff?
+	i = udev->descriptor.bMaxPacketSize0 == 0xff?	/* wusb device? */
 	    512 : udev->descriptor.bMaxPacketSize0;
 	if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) {
 		if (udev->speed != USB_SPEED_FULL ||

-- 

Inaky

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.