aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/template/usb_template.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2011-06-23 07:54:03 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2011-06-23 07:54:03 +0000
commit399e6543b2eea74c22e44cd04d35eb852f744f15 (patch)
tree9c9e570fea963c0c841585afc37116eb5e50f9e0 /sys/dev/usb/template/usb_template.c
parentf6f1dfb66b8361d0fc09b50a882b0b7be2ef26b3 (diff)
downloadsrc-399e6543b2eea74c22e44cd04d35eb852f744f15.tar.gz
src-399e6543b2eea74c22e44cd04d35eb852f744f15.zip
- Add more USB templates for various USB device classes
- Add basic template support for USB 3.0 - Export definition of template sysctl numbers through usb_ioctl.h MFC after: 7 days
Notes
Notes: svn path=/head/; revision=223467
Diffstat (limited to 'sys/dev/usb/template/usb_template.c')
-rw-r--r--sys/dev/usb/template/usb_template.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/sys/dev/usb/template/usb_template.c b/sys/dev/usb/template/usb_template.c
index 7bf17feb3a0a..cf97482f59b0 100644
--- a/sys/dev/usb/template/usb_template.c
+++ b/sys/dev/usb/template/usb_template.c
@@ -49,6 +49,7 @@
#include <sys/priv.h>
#include <dev/usb/usb.h>
+#include <dev/usb/usb_ioctl.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
@@ -141,6 +142,31 @@ usb_make_raw_desc(struct usb_temp_setup *temp,
ud->bSlaveInterface[0] +=
temp->bInterfaceNumber;
}
+
+ /* check if we have got an interface association descriptor */
+
+ if ((raw[0] >= sizeof(struct usb_interface_assoc_descriptor)) &&
+ (raw[1] == UDESC_IFACE_ASSOC)) {
+ struct usb_interface_assoc_descriptor *iad = (void *)dst;
+
+ /* update the interface number */
+
+ iad->bFirstInterface +=
+ temp->bInterfaceNumber;
+ }
+
+ /* check if we have got a call management descriptor */
+
+ if ((raw[0] >= sizeof(struct usb_cdc_cm_descriptor)) &&
+ (raw[1] == UDESC_CS_INTERFACE) &&
+ (raw[2] == UDESCSUB_CDC_CM)) {
+ struct usb_cdc_cm_descriptor *ccd = (void *)dst;
+
+ /* update the interface number */
+
+ ccd->bDataInterface +=
+ temp->bInterfaceNumber;
+ }
}
temp->size += len;
}
@@ -476,6 +502,10 @@ usb_make_device_desc(struct usb_temp_setup *temp,
USETW(utd->udd.bcdUSB, 0x0250);
utd->udd.bMaxPacketSize = 255; /* 512 bytes */
break;
+ case USB_SPEED_SUPER:
+ USETW(utd->udd.bcdUSB, 0x0300);
+ utd->udd.bMaxPacketSize = 9; /* 2**9 = 512 bytes */
+ break;
default:
temp->err = USB_ERR_INVAL;
break;
@@ -1303,15 +1333,27 @@ usb_temp_setup_by_index(struct usb_device *udev, uint16_t index)
usb_error_t err;
switch (index) {
- case 0:
+ case USB_TEMP_MSC:
err = usb_temp_setup(udev, &usb_template_msc);
break;
- case 1:
+ case USB_TEMP_CDCE:
err = usb_temp_setup(udev, &usb_template_cdce);
break;
- case 2:
+ case USB_TEMP_MTP:
err = usb_temp_setup(udev, &usb_template_mtp);
break;
+ case USB_TEMP_MODEM:
+ err = usb_temp_setup(udev, &usb_template_modem);
+ break;
+ case USB_TEMP_AUDIO:
+ err = usb_temp_setup(udev, &usb_template_audio);
+ break;
+ case USB_TEMP_KBD:
+ err = usb_temp_setup(udev, &usb_template_kbd);
+ break;
+ case USB_TEMP_MOUSE:
+ err = usb_temp_setup(udev, &usb_template_mouse);
+ break;
default:
return (USB_ERR_INVAL);
}