aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2014-05-08 08:06:26 -0400
committerFelipe Balbi <balbi@ti.com>2014-05-14 10:39:25 -0400
commitda4243145fb197622425d4c2feff5d6422f2391e (patch)
tree83405fcd69a4ae077c3364f584ab90b1314449a3 /include/linux
parent87213d388e927aaa88b21d5ff7e1f75ca2288da1 (diff)
usb: gadget: configfs: OS Extended Compatibility descriptors support
Add handling of OS Extended Compatibility descriptors from configfs interface. Hosts which expect the "OS Descriptors" ask only for configurations @ index 0, but linux-based USB devices can provide more than one configuration. This patch adds marking one of gadget's configurations the configuration to be reported at index 0, regardless of the actual sequence of usb_add_config invocations used for adding the configurations. The configuration is selected by creating a symbolic link pointing to it from the "os_desc" directory located at the top of a gadget's directory hierarchy. One kind of "OS Descriptors" are "Extended Compatibility Descriptors", which need to be specified per interface. This patch adds interface.<n> directory in function's configfs directory to represent each interface defined by the function. Each interface's directory contains two attributes: "compatible_id" and "sub_compatible_id", which represent 8-byte strings to be reported to the host as the "Compatible ID" and "Sub Compatible ID". Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/usb/composite.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 549f5382b01a..9c3903d76781 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -80,12 +80,16 @@ struct usb_os_desc_ext_prop {
80 * @ext_prop: Extended Properties list 80 * @ext_prop: Extended Properties list
81 * @ext_prop_len: Total length of Extended Properties blobs 81 * @ext_prop_len: Total length of Extended Properties blobs
82 * @ext_prop_count: Number of Extended Properties 82 * @ext_prop_count: Number of Extended Properties
83 * @opts_mutex: Optional mutex protecting config data of a usb_function_instance
84 * @group: Represents OS descriptors associated with an interface in configfs
83 */ 85 */
84struct usb_os_desc { 86struct usb_os_desc {
85 char *ext_compat_id; 87 char *ext_compat_id;
86 struct list_head ext_prop; 88 struct list_head ext_prop;
87 int ext_prop_len; 89 int ext_prop_len;
88 int ext_prop_count; 90 int ext_prop_count;
91 struct mutex *opts_mutex;
92 struct config_group group;
89}; 93};
90 94
91/** 95/**
@@ -381,6 +385,8 @@ extern void usb_composite_unregister(struct usb_composite_driver *driver);
381extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 385extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
382extern int composite_dev_prepare(struct usb_composite_driver *composite, 386extern int composite_dev_prepare(struct usb_composite_driver *composite,
383 struct usb_composite_dev *cdev); 387 struct usb_composite_dev *cdev);
388extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
389 struct usb_ep *ep0);
384void composite_dev_cleanup(struct usb_composite_dev *cdev); 390void composite_dev_cleanup(struct usb_composite_dev *cdev);
385 391
386static inline struct usb_composite_driver *to_cdriver( 392static inline struct usb_composite_driver *to_cdriver(