alistair23-linux/drivers/usb
Bjørn Mork 3edce1cf81 USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND
Userspace applications need to know the maximum supported message
size.

The cdc-wdm driver translates between a character device stream
and a message based protocol.  Each message is transported as a
usb control message with no further encapsulation or syncronization.
Each read or write on the character device should translate to
exactly one usb control message to ensure that message boundaries
are kept intact.  That means that the userspace application must
know the maximum message size supported by the device and driver,
making this size a vital part of the cdc-wdm character device API.

CDC WDM and CDC MBIM functions export the maximum supported
message size through CDC functional descriptors.  The cdc-wdm and
cdc_mbim drivers will parse these descriptors and use the value
chosen by the device.  The only current way for a userspace
application to retrive the value is by duplicating the descriptor
parsing. This is an unnecessary complex task, and application
writers are likely to postpone it, using a fixed value and adding
a "todo" item.

QMI functions have no way to tell the host what message size they
support.  The qmi_wwan driver use a fixed value based on protocol
recommendations and observed device behaviour.  Userspace
applications must know and hard code the same value.  This scheme
will break if we ever encounter a QMI device needing a device
specific message size quirk.  We are currently unable to support
such a device because using a non default size would break the
implicit userspace API.

The message size is currently a hidden attribute of the cdc-wdm
userspace API.  Retrieving it is unnecessarily complex, increasing
the possibility of drivers and applications using different limits.
The resulting errors are hard to debug, and can only be replicated
on identical hardware.

Exporting the maximum message size from the driver simplifies the
task for the userspace application, and creates a unified
information source independent of device and function class. It also
serves to document that the message size is part of the cdc-wdm
userspace API.

This proposed API extension has been presented for the authors of
userspace applications and libraries using the current API: libmbim,
libqmi, uqmi, oFono and ModemManager.  The replies were:

Aleksander Morgado:
 "We do really need max message size for MBIM; and as you say, it may be
  good to have the max message size info also for QMI, so the new ioctl
  seems a good addition. So +1 from my side, for what it's worth."

Dan Williams:
 "Yeah, +1 here.  I'd prefer the sysfs file, but the fact that that
  doesn't work for fd passing pretty much kills it."

No negative replies are so far received.

Cc: Aleksander Morgado <aleksander@lanedo.com>
Cc: Dan Williams <dcbw@redhat.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 13:32:20 -07:00
..
atm
c67x00 usb: c67x00 RetryCnt value in c67x00 TD should be 3 2013-03-07 12:31:37 +08:00
chipidea Merge branch 'usb-linus' into usb-next 2013-03-20 16:21:47 -07:00
class USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND 2013-03-25 13:32:20 -07:00
core USB: hub: Avoid NULL pointer dereference when hub doesn't have any ports 2013-03-25 10:57:37 -07:00
dwc3 usb: dwc3: ep0: fix sparc64 build 2013-03-08 09:42:50 +02:00
early
gadget usb: fixes for v3.9-rc4 2013-03-21 08:40:22 -07:00
host USB: EHCI: fix up incorrect merge resolution 2013-03-21 15:00:18 -07:00
image
misc usb: misc: sisusbvga: Avoid NULL pointer dereference from sisusb 2013-03-15 11:51:01 -07:00
mon
musb usb: fixes for v3.9-rc4 2013-03-21 08:40:22 -07:00
otg Merge branch 'usb-linus' into usb-next 2013-03-20 16:21:47 -07:00
phy Merge branch 'usb-linus' into usb-next 2013-03-20 16:21:47 -07:00
renesas_usbhs USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
serial USB: serial: comments on suspend failure 2013-03-25 10:55:46 -07:00
storage Merge branch 'usb-linus' into usb-next 2013-03-20 16:21:47 -07:00
wusbcore USB: wusbcore/wa-xfer: error handling fixes in setup_segs() 2013-02-06 11:38:14 -08:00
Kconfig USB: select USB_ARCH_HAS_EHCI for MXS 2013-01-11 16:01:06 -08:00
Makefile usb: Makefile: fix drivers/usb/phy/ Makefile entry 2013-03-07 12:29:09 +08:00
README
usb-common.c
usb-skeleton.c

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("khubd").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.