diff options
author | Li Jun <jun.li@nxp.com> | 2018-05-16 09:07:46 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:26:29 -0700 |
commit | 328a3322ca2c5c5bd7b5251b427c7b5864ef92aa (patch) | |
tree | 8008b80bd7880806492eb12395d1b59ed5076a8a /include/linux/usb/composite.h | |
parent | 3596a6132f6b0a04d25c723dff60f786afc9f228 (diff) |
MLK-18376-1 usb: gadget: OS String support
This is a porting patch from linux kernel: 19824d5eeece
("usb: gadget: OS String support"), original commit log
see below:
"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: Li Jun <jun.li@nxp.com>
(cherry picked from commit b6ea0aaee307be0defaf8dc2c1eae9110bdae9a7)
(cherry picked from commit ccc7596829c33eb1b616e3f5ba434edff444f805)
(cherry picked from commit 98d8afdca42c1f0e7a875b628e0fb398af2cdea7)
Diffstat (limited to 'include/linux/usb/composite.h')
-rw-r--r-- | include/linux/usb/composite.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a49a66f2f82..d4f2a49869e 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -284,6 +284,8 @@ struct usb_composite_driver { extern int usb_composite_register(struct usb_composite_driver *); extern void usb_composite_unregister(struct usb_composite_driver *); +#define OS_STRING_QW_SIGN_LEN 14 +#define OS_STRING_IDX 0xEE /** * struct usb_composite_device - represents one composite usb gadget @@ -291,6 +293,9 @@ extern void usb_composite_unregister(struct usb_composite_driver *); * @req: used for control responses; buffer is pre-allocated * @bufsiz: size of buffer pre-allocated in @req * @config: the currently active configuration + * @qw_sign: qwSignature part of the OS string + * @b_vendor_code: bMS_VendorCode part of the OS string + * @use_os_string: false by default, interested gadgets set it * * One of these devices is allocated and initialized before the * associated device driver's bind() is called. @@ -324,6 +329,11 @@ struct usb_composite_dev { struct usb_configuration *config; + /* OS String is a custom (yet popular) extension to the USB standard. */ + u8 qw_sign[OS_STRING_QW_SIGN_LEN]; + u8 b_vendor_code; + unsigned int use_os_string:1; + /* private: */ /* internals */ unsigned int suspended:1; |