Re: [RFC 0/9] OS Descriptors support

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

 



W dniu 24.04.2014 11:17, Andrzej Pietrasiewicz pisze:
There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

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; however PATCH 9/9
shows an example of converting g_ether to use "OS Descriptors" with RNDIS.
The intended use of the extension is with configfs interface, though.

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/9 contains code for supporting the extension proper,
while PATCH 7/9 contains code for using it with configfs.


I forgot to add an example of using "OS Descriptors" with configfs,
so here it is (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

AP


--
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