[PATCHv2 0/8] OS Descriptors support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 series adds (optional) support for gadgets whishing to expose
the so-called "OS Descriptors".

The sequence of operations when a gadget is enumerated by an OS which expects
the said descriptors is as following:

1) the host issues a standard "GET_DESCRIPTOR" request of type 0x03 (string)
for a string at index 0xEE in language 0, named "OS String"
2) if the device responds, the hosts interprets the response, and if it is
of expected form the host assumes the device supports "OS Descriptors"
3) the host issues requests to get "Feature Descriptors" it expects

There are two kinds of "Feature Descriptors": "Extended Compatibility"
descriptors and "Extended Properties" descriptors.
They are specified per USB interface or per USB interface group described
by an IAD.

Legacy gadgets (compiled as separate modules, like g_ether, g_serial etc)
can stay as they are and not use this extension.
The intended use of the extension is with configfs interface.

This series contains an extension to the f_rndis function; if a function
whishes to support "OS Descriptors" it needs to be patched with a fairly
simple change: PATCH 4/8 contains code for supporting the extension proper,
while PATCH 7/8 contains code for using it with configfs.

v1..v2:

- included fixes suggested by Michal: fixed the "not used" comment,
replaced BUG_ON() with compiletime_assert(), folded handling of OS Descriptors
config into the loop (@Michal: it seems to work)

Example gadget is created with the following commands
(I assume s3c-hsotg is used):

$ #USUAL STUFF
$ #===========
$
$ modprobe libcomposite
$ mount none cfg -t configfs
$ mkdir cfg/usb_gadget/g1
$ cd cfg/usb_gadget/g1
$ mkdir configs/c.1
$ mkdir functions/rndis.usb0
$ mkdir strings/0x409
$ mkdir configs/c.1/strings/0x409
$ echo 0x9999 > idProduct
$ echo 0x9999 > idVendor
$ echo 123 > strings/0x409/serialnumber
$ echo manufacturer > strings/0x409/manufacturer
$ echo RNDIS Gadget > strings/0x409/product
$ echo "Conf 1" > configs/c.1/strings/0x409/configuration
$ echo 120 > configs/c.1/MaxPower
$
$ #OS DESCRIPTORS
$ #==============
$
$ #OS STRING
$ #---------
$
$echo 1 > os_desc/use
$ echo 0xcd > os_desc/b_vendor_code
$ echo MSFT100 > os_desc/qw_sign
$
$ #COMPATIBLE ID (SUB COMPATIBLE ID UNUSED)
$ #-------------
$
$ echo RNDIS > functions/rndis.usb0/os_desc/interface.0/compatible_id
$
$ #MAKE c.1 THE ONE ASSOCIATED WITH OS DESCRIPTORS
$ #-----------------------------------------------
$
$ ln -s configs/c.1 os_desc
$
$ #MAKE "Icons" EXTENDED PROPERTY
$ #------------------------------
$
$ mkdir functions/rndis.usb0/os_desc/interface.0/Icons
$ echo 2 > functions/rndis.usb0/os_desc/interface.0/Icons/type
$ echo "%SystemRoot%\\system32\\shell32.dll,-233" > functions/rndis.usb0/os_desc/interface.0/Icons/data
$
$ #MAKE "Label" EXTENDED PROPERTY
$ #------------------------------
$
$ mkdir functions/rndis.usb0/os_desc/interface.0/Label
$ echo 1 > functions/rndis.usb0/os_desc/interface.0/Label/type
$ echo "XYZ Device" > functions/rndis.usb0/os_desc/interface.0/Label/data
$
$ #USUAL STUFF, CONTINUED
$ #======================
$
$ ln -s functions/rndis.usb0 configs/c.1
$ echo s3c-hsotg > UDC


Andrzej Pietrasiewicz (8):
  usb: gadget: FunctionFS: share VLA macros with all usb gadget files
  usb: gadget: OS String support
  usb: gadget: OS Feature Descriptors support
  usb: gadget: f_rndis: OS descriptors support
  usb: gadget: configfs: OS String support
  usb: gadget: configfs: OS Extended Compatibility descriptors support
  usb: gadget: f_rndis: OS Descriptors configfs support
  usb: gadget: configfs: OS Extended Properties descriptors support

 Documentation/ABI/testing/configfs-usb-gadget |  45 +++
 drivers/usb/gadget/composite.c                | 317 ++++++++++++++-
 drivers/usb/gadget/configfs.c                 | 550 +++++++++++++++++++++++++-
 drivers/usb/gadget/configfs.h                 |  12 +
 drivers/usb/gadget/f_fs.c                     |  27 +-
 drivers/usb/gadget/f_rndis.c                  |  31 +-
 drivers/usb/gadget/u_f.h                      |  26 ++
 drivers/usb/gadget/u_os_desc.h                |  90 +++++
 drivers/usb/gadget/u_rndis.h                  |   3 +
 include/linux/usb/composite.h                 |  79 ++++
 10 files changed, 1149 insertions(+), 31 deletions(-)
 create mode 100644 drivers/usb/gadget/u_os_desc.h

-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux