diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/usb/composite.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 7d29ee9363e8..549f5382b01a 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -57,6 +57,53 @@ | |||
57 | struct usb_configuration; | 57 | struct usb_configuration; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * struct usb_os_desc_ext_prop - describes one "Extended Property" | ||
61 | * @entry: used to keep a list of extended properties | ||
62 | * @type: Extended Property type | ||
63 | * @name_len: Extended Property unicode name length, including terminating '\0' | ||
64 | * @name: Extended Property name | ||
65 | * @data_len: Length of Extended Property blob (for unicode store double len) | ||
66 | * @data: Extended Property blob | ||
67 | */ | ||
68 | struct usb_os_desc_ext_prop { | ||
69 | struct list_head entry; | ||
70 | u8 type; | ||
71 | int name_len; | ||
72 | char *name; | ||
73 | int data_len; | ||
74 | char *data; | ||
75 | }; | ||
76 | |||
77 | /** | ||
78 | * struct usb_os_desc - describes OS descriptors associated with one interface | ||
79 | * @ext_compat_id: 16 bytes of "Compatible ID" and "Subcompatible ID" | ||
80 | * @ext_prop: Extended Properties list | ||
81 | * @ext_prop_len: Total length of Extended Properties blobs | ||
82 | * @ext_prop_count: Number of Extended Properties | ||
83 | */ | ||
84 | struct usb_os_desc { | ||
85 | char *ext_compat_id; | ||
86 | struct list_head ext_prop; | ||
87 | int ext_prop_len; | ||
88 | int ext_prop_count; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | * struct usb_os_desc_table - describes OS descriptors associated with one | ||
93 | * interface of a usb_function | ||
94 | * @if_id: Interface id | ||
95 | * @os_desc: "Extended Compatibility ID" and "Extended Properties" of the | ||
96 | * interface | ||
97 | * | ||
98 | * Each interface can have at most one "Extended Compatibility ID" and a | ||
99 | * number of "Extended Properties". | ||
100 | */ | ||
101 | struct usb_os_desc_table { | ||
102 | int if_id; | ||
103 | struct usb_os_desc *os_desc; | ||
104 | }; | ||
105 | |||
106 | /** | ||
60 | * struct usb_function - describes one function of a configuration | 107 | * struct usb_function - describes one function of a configuration |
61 | * @name: For diagnostics, identifies the function. | 108 | * @name: For diagnostics, identifies the function. |
62 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 109 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
@@ -73,6 +120,10 @@ struct usb_configuration; | |||
73 | * be available at super speed. | 120 | * be available at super speed. |
74 | * @config: assigned when @usb_add_function() is called; this is the | 121 | * @config: assigned when @usb_add_function() is called; this is the |
75 | * configuration with which this function is associated. | 122 | * configuration with which this function is associated. |
123 | * @os_desc_table: Table of (interface id, os descriptors) pairs. The function | ||
124 | * can expose more than one interface. If an interface is a member of | ||
125 | * an IAD, only the first interface of IAD has its entry in the table. | ||
126 | * @os_desc_n: Number of entries in os_desc_table | ||
76 | * @bind: Before the gadget can register, all of its functions bind() to the | 127 | * @bind: Before the gadget can register, all of its functions bind() to the |
77 | * available resources including string and interface identifiers used | 128 | * available resources including string and interface identifiers used |
78 | * in interface or class descriptors; endpoints; I/O buffers; and so on. | 129 | * in interface or class descriptors; endpoints; I/O buffers; and so on. |
@@ -129,6 +180,9 @@ struct usb_function { | |||
129 | 180 | ||
130 | struct usb_configuration *config; | 181 | struct usb_configuration *config; |
131 | 182 | ||
183 | struct usb_os_desc_table *os_desc_table; | ||
184 | unsigned os_desc_n; | ||
185 | |||
132 | /* REVISIT: bind() functions can be marked __init, which | 186 | /* REVISIT: bind() functions can be marked __init, which |
133 | * makes trouble for section mismatch analysis. See if | 187 | * makes trouble for section mismatch analysis. See if |
134 | * we can't restructure things to avoid mismatching. | 188 | * we can't restructure things to avoid mismatching. |
@@ -342,10 +396,12 @@ static inline struct usb_composite_driver *to_cdriver( | |||
342 | * struct usb_composite_device - represents one composite usb gadget | 396 | * struct usb_composite_device - represents one composite usb gadget |
343 | * @gadget: read-only, abstracts the gadget's usb peripheral controller | 397 | * @gadget: read-only, abstracts the gadget's usb peripheral controller |
344 | * @req: used for control responses; buffer is pre-allocated | 398 | * @req: used for control responses; buffer is pre-allocated |
399 | * @os_desc_req: used for OS descriptors responses; buffer is pre-allocated | ||
345 | * @config: the currently active configuration | 400 | * @config: the currently active configuration |
346 | * @qw_sign: qwSignature part of the OS string | 401 | * @qw_sign: qwSignature part of the OS string |
347 | * @b_vendor_code: bMS_VendorCode part of the OS string | 402 | * @b_vendor_code: bMS_VendorCode part of the OS string |
348 | * @use_os_string: false by default, interested gadgets set it | 403 | * @use_os_string: false by default, interested gadgets set it |
404 | * @os_desc_config: the configuration to be used with OS descriptors | ||
349 | * | 405 | * |
350 | * One of these devices is allocated and initialized before the | 406 | * One of these devices is allocated and initialized before the |
351 | * associated device driver's bind() is called. | 407 | * associated device driver's bind() is called. |
@@ -375,12 +431,14 @@ static inline struct usb_composite_driver *to_cdriver( | |||
375 | struct usb_composite_dev { | 431 | struct usb_composite_dev { |
376 | struct usb_gadget *gadget; | 432 | struct usb_gadget *gadget; |
377 | struct usb_request *req; | 433 | struct usb_request *req; |
434 | struct usb_request *os_desc_req; | ||
378 | 435 | ||
379 | struct usb_configuration *config; | 436 | struct usb_configuration *config; |
380 | 437 | ||
381 | /* OS String is a custom (yet popular) extension to the USB standard. */ | 438 | /* OS String is a custom (yet popular) extension to the USB standard. */ |
382 | u8 qw_sign[OS_STRING_QW_SIGN_LEN]; | 439 | u8 qw_sign[OS_STRING_QW_SIGN_LEN]; |
383 | u8 b_vendor_code; | 440 | u8 b_vendor_code; |
441 | struct usb_configuration *os_desc_config; | ||
384 | unsigned int use_os_string:1; | 442 | unsigned int use_os_string:1; |
385 | 443 | ||
386 | /* private: */ | 444 | /* private: */ |