From 165fe97ed6107d3cde63592d5ac36400a5eb9f6f Mon Sep 17 00:00:00 2001 From: "Craig W. Nadler" Date: Fri, 15 Jun 2007 23:14:35 -0400 Subject: USB: add IAD support to usbfs and sysfs USB_IAD: Adds support for USB Interface Association Descriptors. This patch adds support to the USB host stack for parsing, storing, and displaying Interface Association Descriptors. In /proc/bus/usb/devices lines starting with A: show the fields in an IAD. In sysfs if an interface on a USB device is referenced by an IAD the following files will be added to the sysfs directory for that interface: iad_bFirstInterface, iad_bInterfaceCount, iad_bFunctionClass, and iad_bFunctionSubClass, iad_bFunctionProtocol Signed-off-by: Craig W. Nadler Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/config.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/usb/core/config.c') diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 5e113db41b59..cb69aa1e02e8 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -295,6 +295,7 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, struct usb_descriptor_header *header; int len, retval; u8 inums[USB_MAXINTERFACES], nalts[USB_MAXINTERFACES]; + unsigned iad_num = 0; memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE); if (config->desc.bDescriptorType != USB_DT_CONFIG || @@ -372,6 +373,20 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, ++n; } + } else if (header->bDescriptorType == + USB_DT_INTERFACE_ASSOCIATION) { + if (iad_num == USB_MAXIADS) { + dev_warn(ddev, "found more Interface " + "Association Descriptors " + "than allocated for in " + "configuration %d\n", cfgno); + } else { + config->intf_assoc[iad_num] = + (struct usb_interface_assoc_descriptor + *)header; + iad_num++; + } + } else if (header->bDescriptorType == USB_DT_DEVICE || header->bDescriptorType == USB_DT_CONFIG) dev_warn(ddev, "config %d contains an unexpected " -- cgit v1.2.3