Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Mar 2009 20:55:12 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 158869 for review
Message-ID:  <200903082055.n28KtCJ8020638@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=158869

Change 158869 by hselasky@hselasky_laptop001 on 2009/03/08 20:54:31

	
	USB serial: Fix sael init code.
	
	Reported by: Alberto Mijares

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/serial/u3g.c#3 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/serial/u3g.c#3 (text+ko) ====

@@ -299,6 +299,7 @@
 	};
 
 	struct usb2_device_request req;
+	usb2_error_t err;
 	uint16_t len;
 	uint8_t buf[0x300];
 	uint8_t n;
@@ -320,25 +321,28 @@
 				DPRINTFN(0, "too small buffer\n");
 				continue;
 			}
-			if (usb2_do_request(udev, NULL, &req, buf)) {
-				DPRINTFN(0, "request %u failed\n",
-				    (unsigned int)n);
-				break;
-			}
+			err = usb2_do_request(udev, NULL, &req, buf);
 		} else {
 			if (len > (sizeof(setup[0]) - 8)) {
 				DPRINTFN(0, "too small buffer\n");
 				continue;
 			}
-			if (usb2_do_request(udev, NULL, &req, 
-			    __DECONST(uint8_t *, &setup[n][8]))) {
-				DPRINTFN(0, "request %u failed\n",
-				    (unsigned int)n);
+			err = usb2_do_request(udev, NULL, &req, 
+			    __DECONST(uint8_t *, &setup[n][8]));
+		}
+		if (err) {
+			DPRINTFN(1, "request %u failed\n",
+			    (unsigned int)n);
+			/*
+			 * Some of the requests will fail. Stop doing
+			 * requests when we are getting timeouts so
+			 * that we don't block the explore/attach
+			 * thread forever.
+			 */
+			if (err == USB_ERR_TIMEOUT)
 				break;
-			}
 		}
 	}
-	return;
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903082055.n28KtCJ8020638>