Date: Tue, 25 Nov 2008 08:04:40 +0000 (UTC) From: Alfred Perlstein <alfred@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185290 - in head: lib/libusb20 sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb2/include sys/dev/usb2/quirk sys/dev/usb2/serial sys/modules/usb2 Message-ID: <200811250804.mAP84el9012939@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alfred Date: Tue Nov 25 08:04:40 2008 New Revision: 185290 URL: http://svn.freebsd.org/changeset/base/185290 Log: src/lib/libusb20/libusb20_compat01.c Fix some issues about re-scanning of the devices. src/lib/libusb20/libusb20_ugen20.c Fix issue about libusb20 having to release the USB transfers before doing a SET_CONFIG, else the kernel will kill the file handle. src/sys/dev/usb2/core/usb2_device. src/sys/dev/usb2/core/usb2_generic.c src/sys/dev/usb2/core/usb2_generic.h Add support for U3G devices. Improve and cleanup FIFO free handling. Improve device re-enumeration. src/sys/dev/usb2/core/usb2_msctest.c src/sys/dev/usb2/core/usb2_msctest.h Fix some problems in the USB Mass Storage Test. Add Huawei vendor specific quirks. src/sys/dev/usb2/core/usb2_request.c Improve device re-enumeration. src/sys/dev/usb2/ethernet/if_aue2.c src/sys/dev/usb2/include/usb2_devid.h src/sys/dev/usb2/include/usb2_devtable.h src/sys/dev/usb2/quirk/usb2_quirk.c Integrate changes from the old USB driver. src/sys/dev/usb2/include/usb2_standard.h Add definition of USB3.0 structures from USB.org. src/sys/dev/usb2/serial/u3g2.c src/sys/dev/usb2/serial/ugensa2.c src/sys/modules/usb2/Makefile src/sys/modules/usb2/serial_3g/Makefile Import U3G driver. Submitted by: Hans Petter Selasky (usb4bsd) Added: head/sys/dev/usb2/serial/u3g2.c (contents, props changed) Modified: head/lib/libusb20/libusb20_compat01.c head/lib/libusb20/libusb20_ugen20.c head/sys/dev/usb2/core/usb2_device.c head/sys/dev/usb2/core/usb2_generic.c head/sys/dev/usb2/core/usb2_generic.h head/sys/dev/usb2/core/usb2_msctest.c head/sys/dev/usb2/core/usb2_msctest.h head/sys/dev/usb2/core/usb2_request.c head/sys/dev/usb2/ethernet/if_aue2.c head/sys/dev/usb2/include/usb2_devid.h head/sys/dev/usb2/include/usb2_devtable.h head/sys/dev/usb2/include/usb2_standard.h head/sys/dev/usb2/quirk/usb2_quirk.c head/sys/dev/usb2/serial/ugensa2.c head/sys/modules/usb2/Makefile Modified: head/lib/libusb20/libusb20_compat01.c ============================================================================== --- head/lib/libusb20/libusb20_compat01.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/lib/libusb20/libusb20_compat01.c Tue Nov 25 08:04:40 2008 (r185290) @@ -177,19 +177,42 @@ usb_open(struct usb_device *dev) if (err) return (NULL); + /* + * Dequeue USB device from backend queue so that it does not get + * freed when the backend is re-scanned: + */ + libusb20_be_dequeue_device(usb_backend, dev->dev); + return (dev->dev); } int -usb_close(usb_dev_handle * dev) +usb_close(usb_dev_handle * udev) { + struct usb_device *dev; int err; - err = libusb20_dev_close((void *)dev); + err = libusb20_dev_close((void *)udev); if (err) return (-1); + if (usb_backend != NULL) { + /* + * Enqueue USB device to backend queue so that it gets freed + * when the backend is re-scanned: + */ + libusb20_be_enqueue_device(usb_backend, (void *)udev); + } else { + /* + * The backend is gone. Free device data so that we + * don't start leaking memory! + */ + dev = usb_device(udev); + libusb20_dev_free((void *)udev); + LIST_DEL(usb_global_bus.devices, dev); + free(dev); + } return (0); } @@ -697,7 +720,8 @@ usb_set_configuration(usb_dev_handle * u /* "bConfigurationValue" not found */ return (-1); } - if ((dev->config + i)->bConfigurationValue == bConfigurationValue) { + if ((dev->config + i)->bConfigurationValue == + bConfigurationValue) { break; } } @@ -821,36 +845,28 @@ usb_find_devices(void) struct libusb20_device *pdev; struct usb_device *udev; struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; - struct libusb20_backend *pold; int err; /* cleanup after last device search */ + /* close all opened devices, if any */ - pold = usb_backend; - - pdev = NULL; - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - if (!pdev->is_opened) { - /* - * if the device has not been opened we free the - * device data - */ - udev = pdev->priv01Data; - libusb20_be_dequeue_device(pold, pdev); - libusb20_dev_free(pdev); - if (udev != NULL) { - LIST_DEL(usb_global_bus.devices, udev); - free(udev); - } - pdev = NULL; /* restart search */ + while ((pdev = libusb20_be_device_foreach(usb_backend, NULL))) { + udev = pdev->priv01Data; + libusb20_be_dequeue_device(usb_backend, pdev); + libusb20_dev_free(pdev); + if (udev != NULL) { + LIST_DEL(usb_global_bus.devices, udev); + free(udev); } } - /* do a new backend device search */ + /* free old USB backend, if any */ + libusb20_be_free(usb_backend); + + /* do a new backend device search */ usb_backend = libusb20_be_alloc_default(); if (usb_backend == NULL) { - usb_backend = pold; /* restore */ return (-1); } /* iterate all devices */ @@ -904,17 +920,6 @@ usb_find_devices(void) LIST_ADD(usb_global_bus.devices, udev); } - /* move old devices over to the new USB backend */ - - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - libusb20_be_dequeue_device(pold, pdev); - libusb20_be_enqueue_device(usb_backend, pdev); - } - - /* free old backend, if any */ - - libusb20_be_free(pold); - return (0); /* success */ } Modified: head/lib/libusb20/libusb20_ugen20.c ============================================================================== --- head/lib/libusb20/libusb20_ugen20.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/lib/libusb20/libusb20_ugen20.c Tue Nov 25 08:04:40 2008 (r185290) @@ -307,10 +307,27 @@ ugen20_init_backend(struct libusb20_back return (0); /* success */ } +static void +ugen20_tr_release(struct libusb20_device *pdev) +{ + struct usb2_fs_uninit fs_uninit; + + if (pdev->nTransfer == 0) { + return; + } + /* release all pending USB transfers */ + if (pdev->privBeData != NULL) { + memset(&fs_uninit, 0, sizeof(fs_uninit)); + if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { + /* ignore any errors of this kind */ + } + } + return; +} + static int ugen20_tr_renew(struct libusb20_device *pdev) { - struct usb2_fs_uninit fs_uninit; struct usb2_fs_init fs_init; struct usb2_fs_endpoint *pfse; int error; @@ -325,12 +342,7 @@ ugen20_tr_renew(struct libusb20_device * } size = nMaxTransfer * sizeof(*pfse); - if (pdev->privBeData != NULL) { - memset(&fs_uninit, 0, sizeof(fs_uninit)); - if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { - /* ignore any errors of this kind */ - } - } else { + if (pdev->privBeData == NULL) { pfse = malloc(size); if (pfse == NULL) { error = LIBUSB20_ERROR_NO_MEM; @@ -338,7 +350,6 @@ ugen20_tr_renew(struct libusb20_device * } pdev->privBeData = pfse; } - /* reset endpoint data */ memset(pdev->privBeData, 0, size); @@ -421,12 +432,11 @@ static int ugen20_close_device(struct libusb20_device *pdev) { struct usb2_fs_uninit fs_uninit; - int error = 0; if (pdev->privBeData) { memset(&fs_uninit, 0, sizeof(fs_uninit)); if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { - error = LIBUSB20_ERROR_OTHER; + /* ignore this error */ } free(pdev->privBeData); } @@ -436,7 +446,7 @@ ugen20_close_device(struct libusb20_devi close(pdev->file_ctrl); pdev->file = -1; pdev->file_ctrl = -1; - return (error); + return (0); /* success */ } static void @@ -509,6 +519,9 @@ ugen20_set_config_index(struct libusb20_ { int temp = cfg_index; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_SET_CONFIG, &temp)) { return (LIBUSB20_ERROR_OTHER); } @@ -548,6 +561,9 @@ ugen20_set_alt_index(struct libusb20_dev alt_iface.uai_interface_index = iface_index; alt_iface.uai_alt_index = alt_index; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_SET_ALTINTERFACE, &alt_iface)) { return (LIBUSB20_ERROR_OTHER); } @@ -559,6 +575,9 @@ ugen20_reset_device(struct libusb20_devi { int temp = 0; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_DEVICEENUMERATE, &temp)) { return (LIBUSB20_ERROR_OTHER); } Modified: head/sys/dev/usb2/core/usb2_device.c ============================================================================== --- head/sys/dev/usb2/core/usb2_device.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_device.c Tue Nov 25 08:04:40 2008 (r185290) @@ -1605,18 +1605,16 @@ repeat_set_config: * Try to figure out if we have an * auto-install disk there: */ - if (usb2_test_autoinstall(udev, 0) == 0) { + if (usb2_test_autoinstall(udev, 0, 0) == 0) { DPRINTFN(0, "Found possible auto-install " "disk (trying next config)\n"); config_index++; goto repeat_set_config; } } - } else if (UGETW(udev->ddesc.idVendor) == USB_VENDOR_HUAWEI) { - if (usb2_test_huawei(udev, 0) == 0) { - DPRINTFN(0, "Found Huawei auto-install disk!\n"); - err = USB_ERR_STALLED; /* fake an error */ - } + } else if (usb2_test_huawei(udev, &uaa) == 0) { + DPRINTFN(0, "Found Huawei auto-install disk!\n"); + err = USB_ERR_STALLED; /* fake an error */ } } else { err = 0; /* set success */ @@ -2114,38 +2112,23 @@ usb2_fifo_free_wrap(struct usb2_device * */ continue; } - if (f->dev_ep_index == 0) { - /* - * Don't free the generic control endpoint - * yet and make sure that any USB-FS - * activity is stopped! - */ - if (ugen_fs_uninit(f)) { - /* ignore any failures */ - DPRINTFN(10, "udev=%p ugen_fs_uninit() " - "failed! (ignored)\n", udev); - } + if ((f->dev_ep_index == 0) && + (f->fs_xfer == NULL)) { + /* no need to free this FIFO */ continue; } } else if (iface_index == USB_IFACE_INDEX_ANY) { if ((f->methods == &usb2_ugen_methods) && - (f->dev_ep_index == 0) && (flag == 0)) { - /* - * Don't free the generic control endpoint - * yet, but make sure that any USB-FS - * activity is stopped! - */ - if (ugen_fs_uninit(f)) { - /* ignore any failures */ - DPRINTFN(10, "udev=%p ugen_fs_uninit() " - "failed! (ignored)\n", udev); - } + (f->dev_ep_index == 0) && (flag == 0) && + (f->fs_xfer == NULL)) { + /* no need to free this FIFO */ continue; } } else { + /* no need to free this FIFO */ continue; } - /* free the FIFO */ + /* free this FIFO */ usb2_fifo_free(f); } return; Modified: head/sys/dev/usb2/core/usb2_generic.c ============================================================================== --- head/sys/dev/usb2/core/usb2_generic.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_generic.c Tue Nov 25 08:04:40 2008 (r185290) @@ -83,7 +83,7 @@ static int usb2_gen_fill_deviceinfo(stru static int ugen_re_enumerate(struct usb2_fifo *f); static int ugen_iface_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags); static uint8_t ugen_fs_get_complete(struct usb2_fifo *f, uint8_t *pindex); - +static int ugen_fs_uninit(struct usb2_fifo *f); /* structures */ @@ -192,6 +192,7 @@ ugen_close(struct usb2_fifo *f, int ffla if (ugen_fs_uninit(f)) { /* ignore any errors - we are closing */ + DPRINTFN(6, "no FIFOs\n"); } return; } @@ -591,6 +592,12 @@ ugen_set_config(struct usb2_fifo *f, uin /* no change needed */ return (0); } + /* make sure all FIFO's are gone */ + /* else there can be a deadlock */ + if (ugen_fs_uninit(f)) { + /* ignore any errors */ + DPRINTFN(6, "no FIFOs\n"); + } /* change setting - will free generic FIFOs, if any */ if (usb2_set_config_index(f->udev, index)) { return (EIO); @@ -612,6 +619,12 @@ ugen_set_interface(struct usb2_fifo *f, /* not possible in device side mode */ return (ENOTTY); } + /* make sure all FIFO's are gone */ + /* else there can be a deadlock */ + if (ugen_fs_uninit(f)) { + /* ignore any errors */ + DPRINTFN(6, "no FIFOs\n"); + } /* change setting - will free generic FIFOs, if any */ if (usb2_set_alt_interface_index(f->udev, iface_index, alt_index)) { return (EIO); Modified: head/sys/dev/usb2/core/usb2_generic.h ============================================================================== --- head/sys/dev/usb2/core/usb2_generic.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_generic.h Tue Nov 25 08:04:40 2008 (r185290) @@ -29,6 +29,5 @@ extern struct usb2_fifo_methods usb2_ugen_methods; int ugen_do_request(struct usb2_fifo *f, struct usb2_ctl_request *ur); -int ugen_fs_uninit(struct usb2_fifo *f); #endif /* _USB2_GENERIC_H_ */ Modified: head/sys/dev/usb2/core/usb2_msctest.c ============================================================================== --- head/sys/dev/usb2/core/usb2_msctest.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_msctest.c Tue Nov 25 08:04:40 2008 (r185290) @@ -36,6 +36,7 @@ #include <dev/usb2/include/usb2_mfunc.h> #include <dev/usb2/include/usb2_error.h> #include <dev/usb2/include/usb2_standard.h> +#include <dev/usb2/include/usb2_devid.h> #define USB_DEBUG_VAR usb2_debug @@ -49,6 +50,7 @@ #include <dev/usb2/core/usb2_device.h> #include <dev/usb2/core/usb2_request.h> #include <dev/usb2/core/usb2_util.h> +#include <dev/usb2/core/usb2_lookup.h> #include <dev/usb2/include/usb2_mfunc.h> #include <dev/usb2/include/usb2_error.h> @@ -70,8 +72,7 @@ enum { DIR_NONE, }; -#define BULK_SIZE 64 /* dummy */ - +#define BULK_SIZE 64 /* dummy */ /* Command Block Wrapper */ struct bbb_cbw { @@ -169,7 +170,7 @@ static const struct usb2_config bbb_conf .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .mh.bufsize = BULK_SIZE, - .mh.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .mh.flags = {.proxy_buffer = 1,}, .mh.callback = &bbb_data_write_callback, .mh.timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -272,6 +273,7 @@ bbb_command_callback(struct usb2_xfer *x USETDW(sc->cbw.dCBWDataTransferLength, sc->data_len); sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); sc->cbw.bCBWLUN = sc->lun; + sc->cbw.bCDBLength = sc->cmd_len; if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) { sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB); DPRINTFN(0, "Truncating long command!\n"); @@ -474,7 +476,8 @@ bbb_command_start(struct bbb_transfer *s * Else: Not an auto install disk. *------------------------------------------------------------------------*/ usb2_error_t -usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index) +usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index, + uint8_t do_eject) { struct usb2_interface *iface; struct usb2_interface_descriptor *id; @@ -534,22 +537,40 @@ usb2_test_autoinstall(struct usb2_device repeat_inquiry: sc->cbw.CBWCDB[0] = 0x12; /* INQUIRY */ + sc->cbw.CBWCDB[1] = 0; + sc->cbw.CBWCDB[2] = 0; + sc->cbw.CBWCDB[3] = 0; + sc->cbw.CBWCDB[4] = 0x24; /* length */ + sc->cbw.CBWCDB[5] = 0; + err = bbb_command_start(sc, DIR_IN, 0, + sc->buffer, 0x24, 6, USB_MS_HZ); - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 6, USB_MS_HZ); - if (err) { - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 12, USB_MS_HZ); - if (err) { - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 16, USB_MS_HZ); - } - } if ((sc->actlen != 0) && (err == 0)) { sid_type = sc->buffer[0] & 0x1F; if (sid_type == 0x05) { /* CD-ROM */ - /* XXX could investigate more */ - return (0); + if (do_eject) { + /* 0: opcode: SCSI START/STOP */ + sc->cbw.CBWCDB[0] = 0x1b; + /* 1: byte2: Not immediate */ + sc->cbw.CBWCDB[1] = 0x00; + /* 2..3: reserved */ + sc->cbw.CBWCDB[2] = 0x00; + sc->cbw.CBWCDB[3] = 0x00; + /* 4: Load/Eject command */ + sc->cbw.CBWCDB[4] = 0x02; + /* 5: control */ + sc->cbw.CBWCDB[5] = 0x00; + err = bbb_command_start(sc, DIR_OUT, 0, + NULL, 0, 6, USB_MS_HZ); + + DPRINTFN(0, "Eject CD command " + "status: %s\n", usb2_errstr(err)); + } + err = 0; + goto done; } - } else if (--timeout) { + } else if ((err != 2) && --timeout) { usb2_pause_mtx(&sc->mtx, USB_MS_HZ); goto repeat_inquiry; } @@ -566,28 +587,136 @@ done: } /* - * Huawei Exxx radio devices have a built in flash disk which is their - * default power up configuration. This allows the device to carry its - * own installation software. - * - * Instead of following the USB spec, and create multiple - * configuration descriptors for this, the devices expects the driver - * to send UF_DEVICE_REMOTE_WAKEUP to endpoint 2 to reset the device, - * so it reprobes, now with the radio exposed. + * NOTE: The entries marked with XXX should be checked for the correct + * speed indication to set the buffer sizes. */ +static const struct usb2_device_id u3g_devs[] = { + /* OEM: Option */ + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36, U3GINFO(U3GSP_HSDPA, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAXHSUPA, U3GINFO(U3GSP_HSDPA, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + /* OEM: Qualcomm, Inc. */ + {USB_VPI(USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_ZTE_STOR, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + /* OEM: Huawei */ + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE, U3GINFO(U3GSP_HSDPA, U3GFL_HUAWEI_INIT))}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220, U3GINFO(U3GSP_HSPA, U3GFL_HUAWEI_INIT))}, + /* OEM: Novatel */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ZEROCD, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_DELL, USB_PRODUCT_DELL_U740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + /* OEM: Merlin */ + {USB_VPI(USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + /* OEM: Sierra Wireless: */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD595, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC595U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC597E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_C597, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM5625, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5725, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MINI5725, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD875, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + /* Sierra TruInstaller device ID */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL, U3GINFO(U3GSP_UMTS, U3GFL_SIERRA_INIT))}, +}; -usb2_error_t -usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index) +static void +u3g_sierra_init(struct usb2_device *udev) { struct usb2_device_request req; + + DPRINTFN(0, "\n"); + + req.bmRequestType = UT_VENDOR; + req.bRequest = UR_SET_INTERFACE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_CONNECTION); + USETW(req.wLength, 0); + + if (usb2_do_request_flags(udev, NULL, &req, + NULL, 0, NULL, USB_MS_HZ)) { + /* ignore any errors */ + } + return; +} + +static void +u3g_huawei_init(struct usb2_device *udev) +{ + struct usb2_device_request req; + + DPRINTFN(0, "\n"); + + req.bmRequestType = UT_WRITE_DEVICE; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_SUSPEND); + USETW(req.wLength, 0); + + if (usb2_do_request_flags(udev, NULL, &req, + NULL, 0, NULL, USB_MS_HZ)) { + /* ignore any errors */ + } + return; +} + +int +usb2_lookup_huawei(struct usb2_attach_arg *uaa) +{ + /* Calling the lookup function will also set the driver info! */ + return (usb2_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); +} + +/* + * The following function handles 3G modem devices (E220, Mobile, + * etc.) with auto-install flash disks for Windows/MacOSX on the first + * interface. After some command or some delay they change appearance + * to a modem. + */ +usb2_error_t +usb2_test_huawei(struct usb2_device *udev, struct usb2_attach_arg *uaa) +{ struct usb2_interface *iface; struct usb2_interface_descriptor *id; - usb2_error_t err; + uint32_t flags; if (udev == NULL) { return (USB_ERR_INVAL); } - iface = usb2_get_iface(udev, iface_index); + iface = usb2_get_iface(udev, 0); if (iface == NULL) { return (USB_ERR_INVAL); } @@ -598,15 +727,21 @@ usb2_test_huawei(struct usb2_device *ude if (id->bInterfaceClass != UICLASS_MASS) { return (USB_ERR_INVAL); } - /* Bend it like Beckham */ - req.bmRequestType = UT_WRITE_DEVICE; - req.bRequest = UR_SET_FEATURE; - USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); - USETW(req.wIndex, 2); - USETW(req.wLength, 0); - - /* We get error at return, but it works */ - err = usb2_do_request_flags(udev, NULL, &req, NULL, 0, NULL, 1 * USB_MS_HZ); + if (usb2_lookup_huawei(uaa)) { + /* no device match */ + return (USB_ERR_INVAL); + } + flags = USB_GET_DRIVER_INFO(uaa); + if (flags & U3GFL_HUAWEI_INIT) { + u3g_huawei_init(udev); + } else if (flags & U3GFL_SCSI_EJECT) { + return (usb2_test_autoinstall(udev, 0, 1)); + } else if (flags & U3GFL_SIERRA_INIT) { + u3g_sierra_init(udev); + } else { + /* no quirks */ + return (USB_ERR_INVAL); + } return (0); /* success */ } Modified: head/sys/dev/usb2/core/usb2_msctest.h ============================================================================== --- head/sys/dev/usb2/core/usb2_msctest.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_msctest.h Tue Nov 25 08:04:40 2008 (r185290) @@ -27,7 +27,30 @@ #ifndef _USB2_MSCTEST_H_ #define _USB2_MSCTEST_H_ -usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index); -usb2_error_t usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index); +usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index, uint8_t do_eject); +usb2_error_t usb2_test_huawei(struct usb2_device *udev, struct usb2_attach_arg *uaa); +int usb2_lookup_huawei(struct usb2_attach_arg *uaa); + +/* Huawei specific defines */ + +#define U3GINFO(flag,speed) ((flag)|((speed) * 256)) +#define U3G_GET_SPEED(uaa) (USB_GET_DRIVER_INFO(uaa) / 256) + +#define U3GFL_NONE 0x00 +#define U3GFL_HUAWEI_INIT 0x01 /* Requires init command (Huawei + * cards) */ +#define U3GFL_SCSI_EJECT 0x02 /* Requires SCSI eject command + * (Novatel) */ +#define U3GFL_SIERRA_INIT 0x04 /* Requires init command (Sierra + * cards) */ + +#define U3GSP_GPRS 0 +#define U3GSP_EDGE 1 +#define U3GSP_CDMA 2 +#define U3GSP_UMTS 3 +#define U3GSP_HSDPA 4 +#define U3GSP_HSUPA 5 +#define U3GSP_HSPA 6 +#define U3GSP_MAX 7 #endif /* _USB2_MSCTEST_H_ */ Modified: head/sys/dev/usb2/core/usb2_request.c ============================================================================== --- head/sys/dev/usb2/core/usb2_request.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_request.c Tue Nov 25 08:04:40 2008 (r185290) @@ -1325,16 +1325,17 @@ usb2_req_get_config(struct usb2_device * 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 @@ usb2_req_re_enumerate(struct usb2_device */ udev->address = USB_START_ADDR; + /* reset "bMaxPacketSize" */ + udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET; + /* * Restore device address: */ @@ -1364,7 +1368,15 @@ usb2_req_re_enumerate(struct usb2_device 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); Modified: head/sys/dev/usb2/ethernet/if_aue2.c ============================================================================== --- head/sys/dev/usb2/ethernet/if_aue2.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/ethernet/if_aue2.c Tue Nov 25 08:04:40 2008 (r185290) @@ -736,6 +736,17 @@ aue_probe(device_t dev) if (uaa->info.bIfaceIndex != AUE_IFACE_IDX) { return (ENXIO); } + /* + * Belkin USB Bluetooth dongles of the F8T012xx1 model series + * conflict with older Belkin USB2LAN adapters. Skip if_aue if + * we detect one of the devices that look like Bluetooth + * adapters. + */ + if ((uaa->info.idVendor == USB_VENDOR_BELKIN) && + (uaa->info.idProduct == USB_PRODUCT_BELKIN_F8T012) && + (uaa->info.bcdDevice == 0x0413)) { + return (ENXIO); + } return (usb2_lookup_id_by_uaa(aue_devs, sizeof(aue_devs), uaa)); } Modified: head/sys/dev/usb2/include/usb2_devid.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devid.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_devid.h Tue Nov 25 08:04:40 2008 (r185290) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.381 2008/11/02 03:00:36 imp Exp + * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -939,6 +939,7 @@ #define USB_PRODUCT_BELKIN_F5U103 0x0103 /* F5U103 Serial */ #define USB_PRODUCT_BELKIN_F5U109 0x0109 /* F5U109 Serial */ #define USB_PRODUCT_BELKIN_USB2SCSI 0x0115 /* USB to SCSI */ +#define USB_PRODUCT_BELKIN_F8T012 0x0121 /* F8T012xx1 Bluetooth USB Adapter */ #define USB_PRODUCT_BELKIN_USB2LAN 0x0121 /* USB to LAN */ #define USB_PRODUCT_BELKIN_F5U208 0x0208 /* F5U208 VideoBus II */ #define USB_PRODUCT_BELKIN_F5U237 0x0237 /* F5U237 USB 2.0 7-Port Hub */ @@ -1709,6 +1710,7 @@ #define USB_PRODUCT_MICROSOFT_MN110 0x007a /* 10/100 USB NIC */ #define USB_PRODUCT_MICROSOFT_WLINTELLIMOUSE 0x008c /* Wireless Optical IntelliMouse */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK 0x00b9 /* Wireless Optical Mouse (Model 1023) */ +#define USB_PRODUCT_MICROSOFT_COMFORT3000 0x00d1 /* Comfort Optical Mouse 3000 (Model 1043) */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK2 0x00e1 /* Wireless Optical Mouse 3000 (Model 1056) */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK3 0x00d2 /* Wireless Optical Mouse 3000 (Model 1049) */ #define USB_PRODUCT_MICROSOFT_WLUSBMOUSE 0x00b9 /* Wireless USB Mouse */ Modified: head/sys/dev/usb2/include/usb2_devtable.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devtable.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_devtable.h Tue Nov 25 08:04:40 2008 (r185290) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.381 2008/11/02 03:00:36 imp Exp + * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -1097,6 +1097,12 @@ const struct usb_knowndev usb_knowndevs[ "USB to SCSI", }, { + USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F8T012, + 0, + "Belkin Components", + "F8T012xx1 Bluetooth USB Adapter", + }, + { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2LAN, 0, "Belkin Components", @@ -4223,6 +4229,12 @@ const struct usb_knowndev usb_knowndevs[ "Wireless Optical Mouse (Model 1023)", }, { + USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_COMFORT3000, + 0, + "Microsoft", + "Comfort Optical Mouse 3000 (Model 1043)", + }, + { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK2, 0, "Microsoft", Modified: head/sys/dev/usb2/include/usb2_standard.h ============================================================================== --- head/sys/dev/usb2/include/usb2_standard.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_standard.h Tue Nov 25 08:04:40 2008 (r185290) @@ -26,6 +26,16 @@ * SUCH DAMAGE. */ +/* + * This file contains standard definitions for the following USB + * protocol versions: + * + * USB v1.0 + * USB v1.1 + * USB v2.0 + * USB v3.0 + */ + #ifndef _USB2_STANDARD_H_ #define _USB2_STANDARD_H_ @@ -133,26 +143,32 @@ struct usb2_device_request { #define UDESC_DEVICE 0x01 #define UDESC_CONFIG 0x02 #define UDESC_STRING 0x03 -#define USB_LANGUAGE_TABLE 0x00 /* Index of the language ID table - * string */ -#define UDESC_INTERFACE 0x04 +#define USB_LANGUAGE_TABLE 0x00 /* language ID string index */ +#define UDESC_INTERFACE 0x04 #define UDESC_ENDPOINT 0x05 #define UDESC_DEVICE_QUALIFIER 0x06 #define UDESC_OTHER_SPEED_CONFIGURATION 0x07 #define UDESC_INTERFACE_POWER 0x08 #define UDESC_OTG 0x09 -#define UDESC_CS_DEVICE 0x21 /* class specific */ -#define UDESC_CS_CONFIG 0x22 -#define UDESC_CS_STRING 0x23 +#define UDESC_DEBUG 0x0A +#define UDESC_IFACE_ASSOC 0x0B /* interface association */ +#define UDESC_BOS 0x0F /* binary object store */ +#define UDESC_DEVICE_CAPABILITY 0x10 +#define UDESC_CS_DEVICE 0x21 /* class specific */ +#define UDESC_CS_CONFIG 0x22 +#define UDESC_CS_STRING 0x23 #define UDESC_CS_INTERFACE 0x24 #define UDESC_CS_ENDPOINT 0x25 #define UDESC_HUB 0x29 +#define UDESC_ENDPOINT_SS_COMP 0x30 /* super speed */ #define UR_SET_DESCRIPTOR 0x07 #define UR_GET_CONFIG 0x08 #define UR_SET_CONFIG 0x09 #define UR_GET_INTERFACE 0x0a #define UR_SET_INTERFACE 0x0b #define UR_SYNCH_FRAME 0x0c +#define UR_SET_SEL 0x30 +#define UR_ISOCH_DELAY 0x31 /* HUB specific request */ #define UR_GET_BUS_STATE 0x02 @@ -160,11 +176,16 @@ struct usb2_device_request { #define UR_RESET_TT 0x09 #define UR_GET_TT_STATE 0x0a #define UR_STOP_TT 0x0b +#define UR_SET_HUB_DEPTH 0x0c +#define UR_GET_PORT_ERR_COUNT 0x0d /* Feature numbers */ #define UF_ENDPOINT_HALT 0 #define UF_DEVICE_REMOTE_WAKEUP 1 #define UF_TEST_MODE 2 +#define UF_U1_ENABLE 0x30 +#define UF_U2_ENABLE 0x31 +#define UF_LTM_ENABLE 0x32 /* HUB specific features */ #define UHF_C_HUB_LOCAL_POWER 0 @@ -174,6 +195,7 @@ struct usb2_device_request { #define UHF_PORT_SUSPEND 2 #define UHF_PORT_OVER_CURRENT 3 #define UHF_PORT_RESET 4 +#define UHF_PORT_LINK_STATE 5 #define UHF_PORT_POWER 8 #define UHF_PORT_LOW_SPEED 9 #define UHF_C_PORT_CONNECTION 16 @@ -184,6 +206,16 @@ struct usb2_device_request { #define UHF_PORT_TEST 21 #define UHF_PORT_INDICATOR 22 +/* SuperSpeed HUB specific features */ +#define UHF_PORT_U1_TIMEOUT 23 +#define UHF_PORT_U2_TIMEOUT 24 +#define UHF_C_PORT_LINK_STATE 25 +#define UHF_C_PORT_CONFIG_ERROR 26 +#define UHF_PORT_REMOTE_WAKE_MASK 27 +#define UHF_BH_PORT_RESET 28 +#define UHF_C_BH_PORT_RESET 29 +#define UHF_FORCE_LINKPM_ACCEPT 30 + struct usb2_descriptor { uByte bLength; uByte bDescriptorType; @@ -195,7 +227,9 @@ struct usb2_device_descriptor { uByte bDescriptorType; uWord bcdUSB; #define UD_USB_2_0 0x0200 -#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) +#define UD_USB_3_0 0x0300 +#define UD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02) +#define UD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03) uByte bDeviceClass; uByte bDeviceSubClass; uByte bDeviceProtocol; @@ -210,6 +244,54 @@ struct usb2_device_descriptor { uByte bNumConfigurations; } __packed; +/* Binary Device Object Store (BOS) */ +struct usb2_bos_descriptor { + uByte bLength; + uByte bDescriptorType; + uWord wTotalLength; + uByte bNumDeviceCaps; +} __packed; + +/* Binary Device Object Store Capability */ +struct usb2_bos_cap_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; +#define USB_DEVCAP_RESERVED 0x00 +#define USB_DEVCAP_WUSB 0x01 +#define USB_DEVCAP_USB2EXT 0x02 +#define USB_DEVCAP_SUPER_SPEED 0x03 +#define USB_DEVCAP_CONTAINER_ID 0x04 + /* data ... */ +} __packed; + +struct usb2_devcap_usb2ext_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bmAttributes; +#define USB_V2EXT_LPM 0x02 +} __packed; + +struct usb2_devcap_ss_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bmAttributes; + uWord wSpeedsSupported; + uByte bFunctionaltySupport; + uByte bU1DevExitLat; + uByte bU2DevExitLat; +} __packed; + +struct usb2_devcap_container_id_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bReserved; + uByte ContainerID; +} __packed; + /* Device class codes */ #define UDCLASS_IN_INTERFACE 0x00 #define UDCLASS_COMM 0x02 @@ -252,6 +334,17 @@ struct usb2_interface_descriptor { uByte iInterface; } __packed; +struct usb2_interface_assoc_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bFirstInterface; + uByte bInterfaceCount; + uByte bFunctionClass; + uByte bFunctionSubClass; + uByte bFunctionProtocol; + uByte iFunction; +} __packed; + /* Interface class codes */ #define UICLASS_UNSPEC 0x00 #define UICLASS_AUDIO 0x01 /* audio */ @@ -372,6 +465,14 @@ struct usb2_endpoint_descriptor { uByte bInterval; } __packed; +struct usb2_endpoint_ss_comp_descriptor { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811250804.mAP84el9012939>