Date: Sat, 8 Dec 2007 11:51:26 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 130484 for review Message-ID: <200712081151.lB8BpQvD039534@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130484 Change 130484 by hselasky@hselasky_laptop001 on 2007/12/08 11:51:08 This commit relates to USB device side support. In USB device side mode we allow "usbd_do_request_flags" to read out the USB descriptors from the USB template system for sake of convenience. All other requests are not supported and should yield an error. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#68 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#63 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#68 (text+ko) ==== @@ -116,7 +116,7 @@ typedef void (usbd_std_root_transfer_func_t)(struct usbd_xfer *, struct usbd_std_root_transfer *); -typedef const uint8_t *(usbd_temp_get_desc_t)(struct usbd_device *udev, uint16_t langid, uint8_t type, uint8_t index); +typedef void (usbd_temp_get_desc_t)(struct usbd_device *udev, struct mtx *mtx, usb_device_request_t *req, const void **data, uint16_t *pLen); /* USB modes */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#63 (text+ko) ==== @@ -2262,6 +2262,7 @@ { struct usbd_xfer *xfer; struct usbd_config uc[1]; + const void *desc; uint32_t level = 0; uint32_t start_ticks; uint32_t delta_ticks; @@ -2283,6 +2284,24 @@ req->wIndex[1], req->wIndex[0], req->wLength[1], req->wLength[0])); + if (udev->usb_mode == USB_MODE_DEVICE) { + PRINTFN(0, ("USB device mode\n")); + (udev->usb_temp_get_desc) (udev, mtx, req, &desc, &temp); + if (desc == NULL) { + return (USBD_INVAL); + } + if (length > temp) { + if (!(flags & USBD_SHORT_XFER_OK)) { + return (USBD_SHORT_XFER); + } + length = temp; + } + if (actlen) { + *actlen = length; + } + bcopy(desc, data, length); + return (0); /* success */ + } if (actlen) { (*actlen) = 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712081151.lB8BpQvD039534>