summaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2014-05-08 08:06:22 -0400
committerFelipe Balbi <balbi@ti.com>2014-05-14 10:38:03 -0400
commit19824d5eeecedfb46639961da1b7a21ba3179930 (patch)
tree5df45a7ed317178936bb77b9dc20b25721edb991 /include/linux/usb
parent74d484669784836c83f23f80ee21a44e9fbf4d59 (diff)
usb: gadget: OS String support
There is a custom (non-USB IF) extension to the USB standard: http://msdn.microsoft.com/library/windows/hardware/gg463182 They grant permission to use the specification - there is "Microsoft OS Descriptor Specification License Agreement" under the link mentioned above, and its Section 2 "Grant of License", letter (b) reads: "Patent license. Microsoft hereby grants to You a nonexclusive, royalty-free, nontransferable, worldwide license under Microsoft’s patents embodied solely within the Specification and that are owned or licensable by Microsoft to make, use, import, offer to sell, sell and distribute directly or indirectly to Your Licensees Your Implementation. You may sublicense this patent license to Your Licensees under the same terms and conditions." The said extension is maintained by Microsoft for Microsoft. Yet it is fairly common for various devices to use it, and a popular proprietary operating system expects devices to provide "OS descriptors", so Linux-based USB gadgets whishing to be able to talk to a variety of operating systems should be able to provide the "OS descriptors". This patch adds optional support for gadgets whishing to expose the so called "OS String" under index 0xEE of language 0. The contents of the string is generated based on the qw_sign array and b_vendor_code. Interested gadgets need to set the cdev->use_os_string flag, fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code with a value of their choice. This patch does not however implement responding to any vendor-specific USB requests. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/composite.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index d3ca3b53837c..7d29ee9363e8 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -335,11 +335,17 @@ static inline struct usb_composite_driver *to_cdriver(
335 return container_of(gdrv, struct usb_composite_driver, gadget_driver); 335 return container_of(gdrv, struct usb_composite_driver, gadget_driver);
336} 336}
337 337
338#define OS_STRING_QW_SIGN_LEN 14
339#define OS_STRING_IDX 0xEE
340
338/** 341/**
339 * struct usb_composite_device - represents one composite usb gadget 342 * struct usb_composite_device - represents one composite usb gadget
340 * @gadget: read-only, abstracts the gadget's usb peripheral controller 343 * @gadget: read-only, abstracts the gadget's usb peripheral controller
341 * @req: used for control responses; buffer is pre-allocated 344 * @req: used for control responses; buffer is pre-allocated
342 * @config: the currently active configuration 345 * @config: the currently active configuration
346 * @qw_sign: qwSignature part of the OS string
347 * @b_vendor_code: bMS_VendorCode part of the OS string
348 * @use_os_string: false by default, interested gadgets set it
343 * 349 *
344 * One of these devices is allocated and initialized before the 350 * One of these devices is allocated and initialized before the
345 * associated device driver's bind() is called. 351 * associated device driver's bind() is called.
@@ -372,6 +378,11 @@ struct usb_composite_dev {
372 378
373 struct usb_configuration *config; 379 struct usb_configuration *config;
374 380
381 /* OS String is a custom (yet popular) extension to the USB standard. */
382 u8 qw_sign[OS_STRING_QW_SIGN_LEN];
383 u8 b_vendor_code;
384 unsigned int use_os_string:1;
385
375 /* private: */ 386 /* private: */
376 /* internals */ 387 /* internals */
377 unsigned int suspended:1; 388 unsigned int suspended:1;