From owner-p4-projects@FreeBSD.ORG Wed Jul 9 21:36:06 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8CE371065681; Wed, 9 Jul 2008 21:36:06 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 502761065675 for ; Wed, 9 Jul 2008 21:36:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 004FD8FC1B for ; Wed, 9 Jul 2008 21:36:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m69La588063307 for ; Wed, 9 Jul 2008 21:36:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m69La5ji063305 for perforce@freebsd.org; Wed, 9 Jul 2008 21:36:05 GMT (envelope-from hselasky@FreeBSD.org) Date: Wed, 9 Jul 2008 21:36:05 GMT Message-Id: <200807092136.m69La5ji063305@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 144971 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2008 21:36:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=144971 Change 144971 by hselasky@hselasky_laptop001 on 2008/07/09 21:35:16 More changes related to LibUSB support. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/bluetooth/ng_ubt2.c#4 edit .. //depot/projects/usb/src/sys/dev/usb2/bluetooth/ubtbcmfw2.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci_atmelarm.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#6 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2_pci.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#4 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_atmelarm.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_pci.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2_pci.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#6 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci_pccard.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_compat_linux.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#10 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#12 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_generic.c#12 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#11 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_request.c#8 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#12 edit .. //depot/projects/usb/src/sys/dev/usb2/include/usb2_ioctl.h#9 edit .. //depot/projects/usb/src/sys/dev/usb2/include/usb2_revision.h#2 edit .. //depot/projects/usb/src/sys/dev/usb2/misc/udbp2.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#5 edit .. //depot/projects/usb/src/sys/dev/usb2/storage/ata-usb2.c#4 edit .. //depot/projects/usb/src/sys/dev/usb2/storage/umass2.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/storage/ustorage2_fs.c#4 edit .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_cdce.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_msc.c#3 edit .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_mtp.c#3 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/bluetooth/ng_ubt2.c#4 (text+ko) ==== @@ -35,7 +35,6 @@ #include #include #include -#include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb2/bluetooth/ubtbcmfw2.c#3 (text+ko) ==== @@ -35,7 +35,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#4 (text+ko) ==== @@ -46,7 +46,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci_atmelarm.c#5 (text+ko) ==== @@ -28,7 +28,6 @@ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#6 (text+ko) ==== @@ -48,7 +48,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2_pci.c#5 (text+ko) ==== @@ -53,7 +53,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2.c#4 (text+ko) ==== @@ -37,7 +37,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_atmelarm.c#5 (text) ==== @@ -26,7 +26,6 @@ __FBSDID("$FreeBSD: src/sys/arm/at91/ohci_atmelarm.c,v 1.4 2007/10/29 21:01:50 imp Exp $"); #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/ohci2_pci.c#5 (text+ko) ==== @@ -51,7 +51,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#5 (text+ko) ==== @@ -40,7 +40,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2_pci.c#5 (text+ko) ==== @@ -49,7 +49,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#6 (text+ko) ==== @@ -25,7 +25,6 @@ #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci_pccard.c#5 (text+ko) ==== @@ -28,7 +28,6 @@ */ #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_compat_linux.c#5 (text+ko) ==== @@ -28,7 +28,6 @@ #include #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#10 (text+ko) ==== @@ -51,6 +51,9 @@ #include #include +#include +#include + #include "usb2_if.h" #include "opt_usb.h" @@ -81,12 +84,6 @@ #define USB_HUB_MAX_DEPTH 5 -/* USB modes */ - -#define USB_MODE_HOST 0 /* default */ -#define USB_MODE_DEVICE 1 -#define USB_MODE_MAX 2 - /* USB transfer states */ #define USB_ST_SETUP 0 ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#12 (text+ko) ==== @@ -27,7 +27,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_generic.c#12 (text+ko) ==== @@ -28,7 +28,6 @@ #include #include #include -#include #define USB_DEBUG_VAR ugen_debug @@ -730,6 +729,75 @@ } /*------------------------------------------------------------------------* + * usb2_gen_fill_devicenames + * + * This function dumps information about an USB device names to + * userland. + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +static int +usb2_gen_fill_devicenames(struct usb2_fifo *f, struct usb2_device_names *dn) +{ + struct usb2_interface *iface; + const char *ptr; + char *dst; + char buf[32]; + int error = 0; + int len; + int max_len; + uint8_t i; + uint8_t first = 1; + + if (f->flag_no_uref) { + /* control endpoint only */ + return (EINVAL); + } + max_len = dn->udn_devnames_len; + dst = dn->udn_devnames_ptr; + + if (max_len == 0) { + return (EINVAL); + } + /* put a zero there */ + error = copyout("", dst, 1); + if (error) { + return (error); + } + for (i = 0;; i++) { + iface = usb2_get_iface(f->udev, i); + if (iface == NULL) { + break; + } + if ((iface->subdev != NULL) && + device_is_attached(iface->subdev)) { + ptr = device_get_nameunit(iface->subdev); + if (!first) { + strlcpy(buf, ", ", sizeof(buf)); + } else { + buf[0] = 0; + } + strlcat(buf, ptr, sizeof(buf)); + len = strlen(buf) + 1; + if (len > max_len) { + break; + } + error = copyout(buf, dst, len); + if (error) { + return (error); + } + len--; + dst += len; + max_len -= len; + first = 0; + } + } + return (0); +} + +/*------------------------------------------------------------------------* * usb2_gen_fill_deviceinfo * * This function dumps information about an USB device to the @@ -742,15 +810,8 @@ static int usb2_gen_fill_deviceinfo(struct usb2_fifo *f, struct usb2_device_info *di) { - enum { - MAX_PORT = (sizeof(di->udi_ports) / sizeof(di->udi_ports[0])), - }; - struct usb2_port *p; - struct usb2_interface *iface; - struct usb2_device *child; struct usb2_device *udev; - uint8_t i; - uint8_t max; + struct usb2_device *hub; if (f->flag_no_uref) { /* control endpoint only */ @@ -762,6 +823,9 @@ di->udi_bus = device_get_unit(udev->bus->bdev); di->udi_addr = udev->address; + di->udi_index = udev->device_index; + strlcpy(di->udi_serial, udev->serial, + sizeof(di->udi_serial)); strlcpy(di->udi_vendor, udev->manufacturer, sizeof(di->udi_vendor)); strlcpy(di->udi_product, udev->product, @@ -774,38 +838,22 @@ di->udi_class = udev->ddesc.bDeviceClass; di->udi_subclass = udev->ddesc.bDeviceSubClass; di->udi_protocol = udev->ddesc.bDeviceProtocol; - di->udi_config = udev->curr_config_no; + di->udi_config_no = udev->curr_config_no; + di->udi_config_index = udev->curr_config_index; di->udi_power = udev->flags.self_powered ? 0 : udev->power; di->udi_speed = udev->speed; - - for (i = 0; i != MIN(USB_MAX_DEVNAMES, USB_IFACE_MAX); i++) { - iface = usb2_get_iface(udev, i); - if (iface && (iface->subdev != NULL) && - device_is_attached(iface->subdev)) { - strlcpy(di->udi_devnames[i], - device_get_nameunit(iface->subdev), - USB_MAX_DEVNAMELEN); - } + di->udi_mode = udev->flags.usb2_mode; + if (udev->flags.suspended) { + di->udi_devstate = USB_DEVSTATE_SUSPENDED; + } else { + di->udi_devstate = USB_DEVSTATE_ENABLED; } - if (udev->hub) { - - max = udev->hub->nports; - if (max > MAX_PORT) { - max = MAX_PORT; - } - di->udi_nports = max; - p = udev->hub->ports; - for (i = 0; i != max; i++, p++) { - - child = usb2_bus_port_get_device(udev->bus, p); - - if (child) { - di->udi_ports[i] = p->device_index; - } else { - di->udi_ports[i] = USB_PORT_POWERED; - } - } + hub = udev->parent_hub; + if (hub) { + di->udi_hubaddr = hub->address; + di->udi_hubindex = hub->device_index; + di->udi_hubport = udev->port_no; } return (0); } @@ -1021,10 +1069,12 @@ /* security checks */ if (fs_ep.nFrames > xfer->max_frame_count) { - return (EINVAL); + xfer->error = USB_ERR_INVAL; + goto complete; } if (fs_ep.nFrames == 0) { - return (EINVAL); + xfer->error = USB_ERR_INVAL; + goto complete; } error = copyin(f->fs_ep_ptr + ep_index, &fs_ep, sizeof(fs_ep)); @@ -1049,7 +1099,8 @@ return (error); } if (length >= sizeof(*req)) { - return (EINVAL); + xfer->error = USB_ERR_INVAL; + goto complete; } if (length) { error = copyin(uaddr, req, length); @@ -1058,7 +1109,8 @@ } } if (ugen_check_request(req)) { - return (EPERM); + xfer->error = USB_ERR_INVAL; + goto complete; } xfer->frlengths[0] = length; @@ -1089,22 +1141,22 @@ if (xfer->timeout > 65535) { xfer->timeout = 65535; } - if (fs_ep.flags & USB2_FS_FLAG_SINGLE_SHORT_OK) + if (fs_ep.flags & USB_FS_FLAG_SINGLE_SHORT_OK) xfer->flags.short_xfer_ok = 1; else xfer->flags.short_xfer_ok = 0; - if (fs_ep.flags & USB2_FS_FLAG_MULTI_SHORT_OK) + if (fs_ep.flags & USB_FS_FLAG_MULTI_SHORT_OK) xfer->flags.short_frames_ok = 1; else xfer->flags.short_frames_ok = 0; - if (fs_ep.flags & USB2_FS_FLAG_FORCE_SHORT) + if (fs_ep.flags & USB_FS_FLAG_FORCE_SHORT) xfer->flags.force_short_xfer = 1; else xfer->flags.force_short_xfer = 0; - if (fs_ep.flags & USB2_FS_FLAG_CLEAR_STALL) + if (fs_ep.flags & USB_FS_FLAG_CLEAR_STALL) xfer->flags.stall_pipe = 1; else xfer->flags.stall_pipe = 0; @@ -1114,33 +1166,34 @@ error = copyin(fs_ep.pLength + n, &length, sizeof(length)); if (error) { - return (error); + break; } xfer->frlengths[n] = length; if (length > rem) { - return (EINVAL); + xfer->error = USB_ERR_INVAL; + goto complete; } rem -= length; if (!isread) { + /* we need to know the source buffer */ + error = copyin(fs_ep.ppBuffer + n, + &uaddr, sizeof(uaddr)); + if (error) { + break; + } if (xfer->flags_int.isochronous_xfr) { /* move data */ - error = copyin(USB_ADD_BYTES(uaddr, offset), - USB_ADD_BYTES(xfer->frbuffers[0].buffer, + error = copyin(uaddr, USB_ADD_BYTES( + xfer->frbuffers[0].buffer, offset), length); if (error) { - return (error); + break; } } else { - /* we need to know the source buffer */ - error = copyin(fs_ep.ppBuffer + n, - &uaddr, sizeof(uaddr)); - if (error) { - return (error); - } /* set current frame offset */ usb2_set_frame_offset(xfer, offset, n); @@ -1148,13 +1201,19 @@ error = copyin(uaddr, xfer->frbuffers[n].buffer, length); if (error) { - return (error); + break; } } } offset += length; } return (error); + +complete: + mtx_lock(f->priv_mtx); + ugen_fs_set_complete(f, ep_index); + mtx_unlock(f->priv_mtx); + return (0); } static int @@ -1195,11 +1254,6 @@ if (xfer->error) { goto complete; } - error = copyin(fs_ep.ppBuffer, - &uaddr, sizeof(uaddr)); - if (error) { - return (error); - } if (xfer->flags_int.control_xfr) { req = xfer->frbuffers[0].buffer; @@ -1220,6 +1274,12 @@ for (; n != xfer->nframes; n++) { + /* we need to know the destination buffer */ + error = copyin(fs_ep.ppBuffer + n, + &uaddr, sizeof(uaddr)); + if (error) { + return (error); + } if (xfer->flags_int.isochronous_xfr) { /* we need to know the initial length */ @@ -1230,7 +1290,8 @@ } /* range check */ if (length > rem) { - return (EINVAL); + fs_ep.status = USB_ERR_INVAL; + goto complete; } rem -= length; temp = offset + length; @@ -1241,7 +1302,7 @@ } /* move data */ error = copyout(USB_ADD_BYTES(xfer->frbuffers[0].buffer, - offset), USB_ADD_BYTES(uaddr, offset), length); + offset), uaddr, length); if (error) { return (error); } @@ -1250,12 +1311,6 @@ length = xfer->frlengths[n]; - /* we need to know the destination buffer */ - error = copyin(fs_ep.ppBuffer + n, - &uaddr, sizeof(uaddr)); - if (error) { - return (error); - } /* move data */ error = copyout(xfer->frbuffers[n].buffer, uaddr, length); @@ -1276,7 +1331,6 @@ /* update "aFrames" */ error = copyout(&fs_ep.aFrames, &(f->fs_ep_ptr + ep_index)->aFrames, sizeof(fs_ep.aFrames)); - if (error) { return (error); } @@ -1394,7 +1448,6 @@ } f->fs_ep_max = pd->ep_index_max; f->fs_ep_ptr = pd->pEndpoints; - f->flag_no_uref = 1; /* drop locks we don't need */ break; } @@ -1429,11 +1482,10 @@ break; } if (pd->max_bufsize > USB_FS_MAX_BUFSIZE) { - error = EINVAL; - break; + pd->max_bufsize = USB_FS_MAX_BUFSIZE; } if (pd->max_frames > USB_FS_MAX_FRAMES) { - error = EINVAL; + pd->max_frames = USB_FS_MAX_FRAMES; break; } if (pd->max_frames == 0) { @@ -1500,11 +1552,18 @@ f->fs_xfer + pd->ep_index, usb2_config, 1, f, f->priv_mtx); if (error == 0) { - /* update maximum buffer size */ + /* update maximums */ + pd->max_packet_length = + f->fs_xfer[pd->ep_index]->max_frame_size; pd->max_bufsize = - f->fs_xfer[pd->ep_index]->max_frame_size; + f->fs_xfer[pd->ep_index]->max_data_length; f->fs_xfer[pd->ep_index]->priv_fifo = ((uint8_t *)0) + pd->ep_index; + /* + * Increase performance by dropping locks we + * don't need: + */ + f->flag_no_uref = 1; } else { error = ENOMEM; } @@ -1784,6 +1843,10 @@ error = usb2_gen_fill_deviceinfo(f, addr); break; + case USB_GET_DEVICENAMES: + error = usb2_gen_fill_devicenames(f, addr); + break; + case USB_DEVICESTATS:{ struct usb2_device_stats *ustat = addr; ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#11 (text+ko) ==== @@ -33,7 +33,6 @@ #include #include #include -#include #define USB_DEBUG_VAR uhub_debug ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_request.c#8 (text+ko) ==== @@ -790,6 +790,10 @@ } /* get full descriptor */ len = UGETW(cd.wTotalLength); + if (len < sizeof(*cdesc)) { + /* corrupt descriptor */ + return (USB_ERR_INVAL); + } cdesc = malloc(len, mtype, M_WAITOK); if (cdesc == NULL) { return (USB_ERR_NOMEM); ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#12 (text+ko) ==== @@ -26,7 +26,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR usb2_debug ==== //depot/projects/usb/src/sys/dev/usb2/include/usb2_ioctl.h#9 (text+ko) ==== @@ -63,8 +63,12 @@ uint8_t reserved[8]; }; -#define USB_MAX_DEVNAMES 4 -#define USB_MAX_DEVNAMELEN 16 +struct usb2_device_names { + char *udn_devnames_ptr; /* userland pointer to comma separated + * list of device names */ + uint16_t udn_devnames_len; /* maximum string length including + * terminating zero */ +}; struct usb2_device_info { uint16_t udi_productNo; @@ -74,23 +78,27 @@ * selfpowered */ uint8_t udi_bus; uint8_t udi_addr; /* device address */ + uint8_t udi_index; /* device index */ uint8_t udi_class; uint8_t udi_subclass; uint8_t udi_protocol; - uint8_t udi_config; - uint8_t udi_speed; + uint8_t udi_config_no; /* current config number */ + uint8_t udi_config_index; /* current config index */ + uint8_t udi_speed; /* see "USB_SPEED_XXX" */ + uint8_t udi_mode; /* see "USB_MODE_XXX" */ uint8_t udi_nports; - uint8_t udi_ports[16]; /* HUB only: addresses of devices on - * ports */ -#define USB_PORT_ENABLED 0xff -#define USB_PORT_SUSPENDED 0xfe -#define USB_PORT_POWERED 0xfd -#define USB_PORT_DISABLED 0xfc - + uint8_t udi_hubaddr; /* parent HUB address */ + uint8_t udi_hubindex; /* parent HUB device index */ + uint8_t udi_hubport; /* parent HUB port */ + uint8_t udi_devstate; +#define USB_DEVSTATE_ENABLED 0x0 +#define USB_DEVSTATE_SUSPENDED 0x1 +#define USB_DEVSTATE_POWERED 0x2 +#define USB_DEVSTATE_DISABLED 0x3 char udi_product[128]; char udi_vendor[128]; + char udi_serial[64]; char udi_release[8]; - char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; }; struct usb2_device_stats { @@ -98,10 +106,6 @@ uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */ }; -struct usb2_device_enumerate { - uint8_t ude_addr; /* not used */ -}; - struct usb2_fs_start { uint8_t ep_index; }; @@ -116,8 +120,6 @@ /* This structure is used for all endpoint types */ struct usb2_fs_endpoint { - void *priv_sc0; /* private client data */ - void *priv_sc1; /* private client data */ /* * NOTE: isochronous USB transfer only use one buffer, but can have * multiple frame lengths ! @@ -129,16 +131,16 @@ uint32_t aFrames; /* actual number of frames */ uint16_t flags; /* a single short frame will terminate */ -#define USB2_FS_FLAG_SINGLE_SHORT_OK 0x0001 +#define USB_FS_FLAG_SINGLE_SHORT_OK 0x0001 /* multiple short frames are allowed */ -#define USB2_FS_FLAG_MULTI_SHORT_OK 0x0002 +#define USB_FS_FLAG_MULTI_SHORT_OK 0x0002 /* all frame(s) transmitted are short terminated */ -#define USB2_FS_FLAG_FORCE_SHORT 0x0004 +#define USB_FS_FLAG_FORCE_SHORT 0x0004 /* will do a clear-stall before xfer */ -#define USB2_FS_FLAG_CLEAR_STALL 0x0008 +#define USB_FS_FLAG_CLEAR_STALL 0x0008 uint16_t timeout; /* in milliseconds */ /* timeout value for no timeout */ -#define USB2_FS_TIMEOUT_NONE 0 +#define USB_FS_TIMEOUT_NONE 0 uint8_t status; /* see USB_ERR_XXX */ }; @@ -158,6 +160,7 @@ uint32_t max_bufsize; #define USB_FS_MAX_FRAMES (1 << 12) uint32_t max_frames; + uint16_t max_packet_length; /* read only */ uint8_t dev_index; /* currently unused */ uint8_t ep_index; uint8_t ep_no; /* bEndpointNumber */ @@ -177,7 +180,7 @@ #define USB_DISCOVER _IO ('U', 3) #define USB_DEVICEINFO _IOWR('U', 4, struct usb2_device_info) #define USB_DEVICESTATS _IOR ('U', 5, struct usb2_device_stats) -#define USB_DEVICEENUMERATE _IOW ('U', 6, struct usb2_device_enumerate) +#define USB_DEVICEENUMERATE _IOW ('U', 6, int) /* Generic HID device */ #define USB_GET_REPORT_DESC _IOR ('U', 21, struct usb2_gen_descriptor) @@ -206,6 +209,11 @@ #define USB_SET_BUFFER_SIZE _IOW ('U', 118, uint32_t) #define USB_SET_RX_STALL_FLAG _IOW ('U', 119, int) #define USB_SET_TX_STALL_FLAG _IOW ('U', 120, int) +#define USB_GET_DEVICENAMES _IOW ('U', 121, struct usb2_device_names) +#define USB_CLAIM_INTERFACE _IOW ('U', 122, int) +#define USB_RELEASE_INTERFACE _IOW ('U', 123, int) +#define USB_IFACE_DRIVER_ACTIVE _IOW ('U', 124, int) +#define USB_IFACE_DRIVER_DETACH _IOW ('U', 125, int) /* Modem device */ #define USB_GET_CM_OVER_DATA _IOR ('U', 130, int) ==== //depot/projects/usb/src/sys/dev/usb2/include/usb2_revision.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,13 @@ USB_MAKE_ENUM(USB_REV); +/* + * The "USB_MODE" macro defines all the supported USB modes. + */ +#define USB_MODE(m,n)\ +m(n, USB_MODE_HOST)\ +m(n, USB_MODE_DEVICE)\ + +USB_MAKE_ENUM(USB_MODE); + #endif /* _USB2_REVISION_H_ */ ==== //depot/projects/usb/src/sys/dev/usb2/misc/udbp2.c#3 (text+ko) ==== @@ -61,7 +61,6 @@ #include #include #include -#include #define USB_DEBUG_VAR udbp_debug ==== //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#5 (text+ko) ==== @@ -56,7 +56,6 @@ #include #include #include -#include #define USB_DEBUG_VAR uaudio_debug ==== //depot/projects/usb/src/sys/dev/usb2/storage/ata-usb2.c#4 (text) ==== @@ -34,7 +34,6 @@ #include #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/storage/umass2.c#3 (text+ko) ==== @@ -106,7 +106,6 @@ #include #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/storage/ustorage2_fs.c#4 (text+ko) ==== @@ -38,7 +38,6 @@ #include #include #include -#include #include #define USB_DEBUG_VAR ustorage_fs_debug ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#3 (text+ko) ==== @@ -31,7 +31,6 @@ #include #include #include -#include #include #include ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_cdce.c#3 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include #include -#include #include ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_msc.c#3 (text+ko) ==== @@ -33,7 +33,6 @@ #include #include -#include #include ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template_mtp.c#3 (text+ko) ==== @@ -34,7 +34,6 @@ #include #include -#include #include