Date: Sun, 16 Nov 2008 11:34:58 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 153027 for review Message-ID: <200811161134.mAGBYw6Q023645@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=153027 Change 153027 by hselasky@hselasky_laptop001 on 2008/11/16 11:34:16 Improve USB re-enumeration code. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_request.c#23 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_request.c#23 (text+ko) ==== @@ -1325,16 +1325,17 @@ usb2_error_t usb2_req_re_enumerate(struct usb2_device *udev, struct mtx *mtx) { - struct usb2_device_descriptor ddesc; struct usb2_device *parent_hub; usb2_error_t err; uint8_t old_addr; + if (udev->flags.usb2_mode != USB_MODE_HOST) { + return (USB_ERR_INVAL); + } old_addr = udev->address; parent_hub = udev->parent_hub; if (parent_hub == NULL) { - err = USB_ERR_INVAL; - goto done; + return (USB_ERR_INVAL); } err = usb2_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { @@ -1347,6 +1348,9 @@ */ udev->address = USB_START_ADDR; + /* reset "bMaxPacketSize" */ + udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET; + /* * Restore device address: */ @@ -1364,7 +1368,15 @@ usb2_pause_mtx(mtx, USB_SET_ADDRESS_SETTLE); /* get the device descriptor */ - err = usb2_req_get_device_desc(udev, mtx, &ddesc); + err = usb2_req_get_desc(udev, mtx, &udev->ddesc, + USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); + if (err) { + DPRINTFN(0, "getting device descriptor " + "at addr %d failed!\n", udev->address); + goto done; + } + /* get the full device descriptor */ + err = usb2_req_get_device_desc(udev, mtx, &udev->ddesc); if (err) { DPRINTFN(0, "addr=%d, getting device " "descriptor failed!\n", old_addr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811161134.mAGBYw6Q023645>