summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-03-08 22:55:17 +0000
committerthompsa <thompsa@FreeBSD.org>2009-03-08 22:55:17 +0000
commit4340033049f4924f56d3d668b704358f5cdd0d2f (patch)
tree86b54cb90ede0e5ed7b8b21e8a9b6656426c7313 /sys/dev/usb
parent417d444e25364a90e1e3eb3565ff46c86aabb32c (diff)
downloadFreeBSD-src-4340033049f4924f56d3d668b704358f5cdd0d2f.zip
FreeBSD-src-4340033049f4924f56d3d668b704358f5cdd0d2f.tar.gz
MFp4 //depot/projects/usb@158869
Fix sael init code. Reported by: Alberto Mijares Submitted by: Hans Petter Selasky
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/serial/u3g.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index dd182fd..4b79aae 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -299,6 +299,7 @@ u3g_sael_m460_init(struct usb2_device *udev)
};
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 *udev)
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
OpenPOWER on IntegriCloud