]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: <linux/usb_ch9.h> new descriptor codes, types
authorDavid Brownell <david-b@pacbell.net>
Mon, 15 Dec 2003 05:38:28 +0000 (21:38 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 15 Dec 2003 05:38:28 +0000 (21:38 -0800)
This patch adds definitions:

  - New "video" class, for video cameras and more complicated devices;

  - New "Interface association" descriptor type, used by video class,
    along with two other assigned desciptor type codes (OTG, "debug")
    listed in the same ECN to the USB 2.0 spec;

  - Type declarations for "Interface association" and OTG descriptors.

It also replaces three copies of USB_DT_CS_* declarations in audio
support with one in <linux/usb_ch9.h>, and uses the newly exposed
symbol in "usbnet".  (Near as I can tell, the convention for those
"class specific" descriptor types started with audio, and was then
adopted by several other class specifications.)

drivers/usb/class/audio.h
drivers/usb/class/usb-midi.h
drivers/usb/net/usbnet.c
include/linux/usb_ch9.h
sound/usb/usbaudio.h

index bb51e468bac6cdc4b2a62dcd63754d2d26f6f4bc..45916eb12103ed5d6a674c233893477cb701eabf 100644 (file)
@@ -1,9 +1,3 @@
-#define USB_DT_CS_DEVICE                0x21
-#define USB_DT_CS_CONFIG                0x22
-#define USB_DT_CS_STRING                0x23
-#define USB_DT_CS_INTERFACE             0x24
-#define USB_DT_CS_ENDPOINT              0x25
-
 #define CS_AUDIO_UNDEFINED             0x20
 #define CS_AUDIO_DEVICE                        0x21
 #define CS_AUDIO_CONFIGURATION         0x22
index 1e99c991de5b0327334ab0585c5ec47dc760763e..0e6eac11602aef0025cbae3b3ee0f79d0c5295d8 100644 (file)
 #define USB_SUBCLASS_MIDISTREAMING     3
 #endif
 
-#define USB_DT_CS_DEVICE               0x21
-#define USB_DT_CS_CONFIG               0x22
-#define USB_DT_CS_STRING               0x23
-#define USB_DT_CS_INTERFACE            0x24
-#define USB_DT_CS_ENDPOINT             0x25
-
 /* ------------------------------------------------------------------------- */
 /* Roland MIDI Devices */
 
index 25d5b21f77a60f3f79c20350acd209d70655366c..e3447d092f5f697fb16b55a145083e48e547192b 100644 (file)
@@ -923,8 +923,7 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf)
        memset (info, 0, sizeof *info);
        info->control = intf;
        while (len > 3) {
-               /* ignore bDescriptorType != CS_INTERFACE */
-               if (buf [1] != 0x24)
+               if (buf [1] != USB_DT_CS_INTERFACE)
                        goto next_desc;
 
                /* bDescriptorSubType identifies three "must have" descriptors;
index 916378f747c17c3019766ea7ad5293d3ef0fc590..682e9511487001be4cb13c091645948c34a3f886 100644 (file)
@@ -116,6 +116,17 @@ struct usb_ctrlrequest {
 #define USB_DT_DEVICE_QUALIFIER                0x06
 #define USB_DT_OTHER_SPEED_CONFIG      0x07
 #define USB_DT_INTERFACE_POWER         0x08
+/* these are from a minor usb 2.0 revision (ECN) */
+#define USB_DT_OTG                     0x09
+#define USB_DT_DEBUG                   0x0a
+#define USB_DT_INTERFACE_ASSOCIATION   0x0b
+
+/* conventional codes for class-specific descriptors */
+#define USB_DT_CS_DEVICE               0x21
+#define USB_DT_CS_CONFIG               0x22
+#define USB_DT_CS_STRING               0x23
+#define USB_DT_CS_INTERFACE            0x24
+#define USB_DT_CS_ENDPOINT             0x25
 
 /* All standard descriptors have these 2 fields at the beginning */
 struct usb_descriptor_header {
@@ -165,6 +176,7 @@ struct usb_device_descriptor {
 #define USB_CLASS_CDC_DATA             0x0a
 #define USB_CLASS_CSCID                        0x0b    /* chip+ smart card */
 #define USB_CLASS_CONTENT_SEC          0x0d    /* content security */
+#define USB_CLASS_VIDEO                        0x0e
 #define USB_CLASS_APP_SPEC             0xfe
 #define USB_CLASS_VENDOR_SPEC          0xff
 
@@ -281,6 +293,36 @@ struct usb_qualifier_descriptor {
 } __attribute__ ((packed));
 
 
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_OTG (from OTG 1.0a supplement) */
+struct usb_otg_descriptor {
+       __u8  bLength;
+       __u8  bDescriptorType;
+
+       __u8  bmAttributes;     /* support for HNP, SRP, etc */
+} __attribute__ ((packed));
+
+/* from usb_otg_descriptor.bmAttributes */
+#define USB_OTG_SRP            (1 << 0)
+#define USB_OTG_HNP            (1 << 1)        /* swap host/device roles */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
+struct usb_interface_assoc_descriptor {
+       __u8  bLength;
+       __u8  bDescriptorType;
+
+       __u8  bFirstInterface;
+       __u8  bInterfaceCount;
+       __u8  bFunctionClass;
+       __u8  bFunctionSubClass;
+       __u8  bFunctionProtocol;
+       __u8  iFunction;
+} __attribute__ ((packed));
+
+
 /*-------------------------------------------------------------------------*/
 
 /* USB 2.0 defines three speeds, here's how Linux identifies them */
index 2420cabba0114afa10ecd70c38b07ceeb8d1dcaf..1706a1be5ec8728dcdc97369415af3a610c721c9 100644 (file)
 #define USB_SUBCLASS_MIDI_STREAMING    0x03
 #define USB_SUBCLASS_VENDOR_SPEC       0xff
 
-#define USB_DT_CS_DEVICE                0x21
-#define USB_DT_CS_CONFIG                0x22
-#define USB_DT_CS_STRING                0x23
-#define USB_DT_CS_INTERFACE             0x24
-#define USB_DT_CS_ENDPOINT              0x25
-
 #define CS_AUDIO_UNDEFINED             0x20
 #define CS_AUDIO_DEVICE                        0x21
 #define CS_AUDIO_CONFIGURATION         0x22