diff options
| author | David Brownell <david-b@pacbell.net> | 2002-10-29 07:43:32 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-10-29 07:43:32 -0800 |
| commit | 63bc762f9bdca7bdbef44bd6a1c0e2936f4c5096 (patch) | |
| tree | c153bed788422505f2fa64524f7c5249d0738119 /include/linux/usb.h | |
| parent | 844acee5584660274c221eaee1d8c0ea36f931d0 (diff) | |
[PATCH] USB: clean up usb structures some more
This patch splits up the usb structures to have two structs,
"usb_XXX_descriptor" with just the descriptor, and "usb_host_XXX" (or
something similar) to wrap it and add the "extra" pointers plus the
array of related descriptors that the host parsed during enumeration.
(2 or 3 words extra in each"usb_host_XXX".) This further matches the
"on the wire" data and enables the gadget drivers to share the same
header file.
Covers all the linux/drivers/usb/* and linux/sound/usb/* stuff, but
not a handful of other drivers (bluetooth, iforce, hisax, irda) that
are out of the usb tree and will likely be affected.
Diffstat (limited to 'include/linux/usb.h')
| -rw-r--r-- | include/linux/usb.h | 94 |
1 files changed, 35 insertions, 59 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 1d9873868a90..0f486d95bdb7 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -41,56 +41,36 @@ struct usb_device; /*-------------------------------------------------------------------------*/ /* - * Standard USB Descriptor support. + * Host-side wrappers for standard USB descriptors ... these are parsed + * from the data provided by devices. Parsing turns them from a flat + * sequence of descriptors into a hierarchy: + * + * - devices have one (usually) or more configs; + * - configs have one (often) or more interfaces; + * - interfaces have one (usually) or more settings; + * - each interface setting has zero or (usually) more endpoints. + * + * And there might be other descriptors mixed in with those. + * * Devices may also have class-specific or vendor-specific descriptors. */ -/* - * Descriptor sizes per descriptor type - */ -#define USB_DT_DEVICE_SIZE 18 -#define USB_DT_CONFIG_SIZE 9 -#define USB_DT_INTERFACE_SIZE 9 -#define USB_DT_ENDPOINT_SIZE 7 -#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ - -/* most of these maximums are arbitrary */ -#define USB_MAXCONFIG 8 -#define USB_ALTSETTINGALLOC 4 -#define USB_MAXALTSETTING 128 /* Hard limit */ -#define USB_MAXINTERFACES 32 -#define USB_MAXENDPOINTS 32 /* Hard limit */ - -/* USB_DT_ENDPOINT: Endpoint descriptor */ -struct usb_endpoint_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u8 bEndpointAddress __attribute__ ((packed)); - __u8 bmAttributes __attribute__ ((packed)); - __u16 wMaxPacketSize __attribute__ ((packed)); - __u8 bInterval __attribute__ ((packed)); - __u8 bRefresh __attribute__ ((packed)); - __u8 bSynchAddress __attribute__ ((packed)); - - /* the rest is internal to the Linux implementation */ +/* host-side wrapper for parsed endpoint descriptors */ +struct usb_host_endpoint { + struct usb_endpoint_descriptor desc; + unsigned char *extra; /* Extra descriptors */ int extralen; }; -/* USB_DT_INTERFACE: Interface descriptor */ -struct usb_interface_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u8 bInterfaceNumber __attribute__ ((packed)); - __u8 bAlternateSetting __attribute__ ((packed)); - __u8 bNumEndpoints __attribute__ ((packed)); - __u8 bInterfaceClass __attribute__ ((packed)); - __u8 bInterfaceSubClass __attribute__ ((packed)); - __u8 bInterfaceProtocol __attribute__ ((packed)); - __u8 iInterface __attribute__ ((packed)); - - /* the rest is internal to the Linux implementation */ - struct usb_endpoint_descriptor *endpoint; +/* host-side wrapper for one interface setting's parsed descriptors */ +struct usb_host_interface { + struct usb_interface_descriptor desc; + + /* array of desc.bNumEndpoint endpoints associated with this + * interface setting. these will be in no particular order. + */ + struct usb_host_endpoint *endpoint; unsigned char *extra; /* Extra descriptors */ int extralen; @@ -127,7 +107,10 @@ struct usb_interface_descriptor { * will use them in non-default settings. */ struct usb_interface { - struct usb_interface_descriptor *altsetting; + /* array of alternate settings for this interface. + * these will be in numeric order, 0..num_altsettting + */ + struct usb_host_interface *altsetting; unsigned act_altsetting; /* active alternate setting */ unsigned num_altsetting; /* number of alternate settings */ @@ -148,17 +131,12 @@ struct usb_interface { * different depending on what speed they're currently running. Only * devices with a USB_DT_DEVICE_QUALIFIER have an OTHER_SPEED_CONFIG. */ -struct usb_config_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u16 wTotalLength __attribute__ ((packed)); - __u8 bNumInterfaces __attribute__ ((packed)); - __u8 bConfigurationValue __attribute__ ((packed)); - __u8 iConfiguration __attribute__ ((packed)); - __u8 bmAttributes __attribute__ ((packed)); - __u8 MaxPower __attribute__ ((packed)); - - /* the rest is internal to the Linux implementation */ +struct usb_host_config { + struct usb_config_descriptor desc; + + /* the interfaces associated with this configuration + * these will be in numeric order, 0..desc.bNumInterfaces + */ struct usb_interface *interface; unsigned char *extra; /* Extra descriptors */ @@ -178,8 +156,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, /* -------------------------------------------------------------------------- */ -/* Host Controller Driver (HCD) support */ - struct usb_operations; /* @@ -248,8 +224,8 @@ struct usb_device { struct device dev; /* Generic device interface */ struct usb_device_descriptor descriptor;/* Descriptor */ - struct usb_config_descriptor *config; /* All of the configs */ - struct usb_config_descriptor *actconfig;/* the active configuration */ + struct usb_host_config *config; /* All of the configs */ + struct usb_host_config *actconfig;/* the active configuration */ char **rawdescriptors; /* Raw descriptors for each config */ |
