From owner-svn-src-all@FreeBSD.ORG Sun Mar 8 22:55:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB6FB106566B; Sun, 8 Mar 2009 22:55:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99A7C8FC14; Sun, 8 Mar 2009 22:55:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n28MtHwF001411; Sun, 8 Mar 2009 22:55:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n28MtH7C001409; Sun, 8 Mar 2009 22:55:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903082255.n28MtH7C001409@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Mar 2009 22:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189546 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Mar 2009 22:55:18 -0000 Author: thompsa Date: Sun Mar 8 22:55:17 2009 New Revision: 189546 URL: http://svn.freebsd.org/changeset/base/189546 Log: MFp4 //depot/projects/usb@158869 Fix sael init code. Reported by: Alberto Mijares Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:19:28 2009 (r189545) +++ head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:55:17 2009 (r189546) @@ -299,6 +299,7 @@ u3g_sael_m460_init(struct usb2_device *u }; struct usb2_device_request req; + usb2_error_t err; uint16_t len; uint8_t buf[0x300]; uint8_t n; @@ -320,25 +321,28 @@ u3g_sael_m460_init(struct usb2_device *u 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