Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (148 commits)
  USB: serial: fix stalled writes
  USB: remove fake "address-of" expressions
  USB: fix thread-unsafe anchor utiliy routines
  USB: usbtest: support test device with only one iso-in or iso-out endpoint
  USB: usbtest: avoid to free coherent buffer in atomic context
  USB: xhci: Set DMA mask for host.
  USB: xhci: Don't flush doorbell writes.
  USB: xhci: Reduce reads and writes of interrupter registers.
  USB: xhci: Make xhci_set_hc_event_deq() static.
  USB: xhci: Minimize HW event ring dequeue pointer writes.
  USB: xhci: Make xhci_handle_event() static.
  USB: xhci: Remove unnecessary reads of IRQ_PENDING register.
  USB: xhci: Performance - move xhci_work() into xhci_irq()
  USB: xhci: Performance - move interrupt handlers into xhci-ring.c
  USB: xhci: Performance - move functions that find ep ring.
  USB:: fix linux/usb.h kernel-doc warnings
  USB: add USB serial ssu100 driver
  USB: usb-storage: implement autosuspend
  USB: ehci: fix remove of ehci debugfs dir
  USB: Add USB 2.0 to ssb ohci driver
  ...
  • Loading branch information
torvalds committed Aug 10, 2010
2 parents fc385c3 + b58af40 commit 9895850
Show file tree
Hide file tree
Showing 140 changed files with 5,086 additions and 2,193 deletions.
12 changes: 12 additions & 0 deletions Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ Description:
0 -> resumed

(_UDC_ is the name of the USB Device Controller driver)

What: /sys/devices/platform/_UDC_/gadget/gadget-lunX/nofua
Date: July 2010
Contact: Andy Shevchenko <[email protected]>
Description:
Show or set the reaction on the FUA (Force Unit Access) bit in
the SCSI WRITE(10,12) commands when a gadget in USB Mass
Storage mode.

Possible values are:
1 -> ignore the FUA flag
0 -> obey the FUA flag
2 changes: 1 addition & 1 deletion Documentation/usb/ehci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ compatible with the USB 1.1 standard. It defines three transfer speeds:
- "Low Speed" 1.5 Mbit/sec

USB 1.1 only addressed full speed and low speed. High speed devices
can be used on USB 1.1 systems, but they slow down to USB 1.1 speeds.
can be used on USB 1.1 systems, but they slow down to USB 1.1 speeds.

USB 1.1 devices may also be used on USB 2.0 systems. When plugged
into an EHCI controller, they are given to a USB 1.1 "companion"
Expand Down
150 changes: 150 additions & 0 deletions Documentation/usb/gadget_multi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
-*- org -*-

* Overview

The Multifunction Composite Gadget (or g_multi) is a composite gadget
that makes extensive use of the composite framework to provide
a... multifunction gadget.

In it's standard configuration it provides a single USB configuration
with RNDIS[1] (that is Ethernet), USB CDC[2] ACM (that is serial) and
USB Mass Storage functions.

A CDC ECM (Ethernet) function may be turned on via a Kconfig option
and RNDIS can be turned off. If they are both enabled the gadget will
have two configurations -- one with RNDIS and another with CDC ECM[3].

Please not that if you use non-standard configuration (that is enable
CDC ECM) you may need to change vendor and/or product ID.

* Host drivers

To make use of the gadget one needs to make it work on host side --
without that there's no hope of achieving anything with the gadget.
As one might expect, things one need to do very from system to system.

** Linux host drivers

Since the gadget uses standard composite framework and appears as such
to Linux host it does not need any additional drivers on Linux host
side. All the functions are handled by respective drivers developed
for them.

This is also true for two configuration set-up with RNDIS
configuration being the first one. Linux host will use the second
configuration with CDC ECM which should work better under Linux.

** Windows host drivers

For the gadget two work under Windows two conditions have to be met:

*** Detecting as composite gadget

First of all, Windows need to detect the gadget as an USB composite
gadget which on its own have some conditions[4]. If they are met,
Windows lets USB Generic Parent Driver[5] handle the device which then
tries to much drivers for each individual interface (sort of, don't
get into too many details).

The good news is: you do not have to worry about most of the
conditions!

The only thing to worry is that the gadget has to have a single
configuration so a dual RNDIS and CDC ECM gadget won't work unless you
create a proper INF -- and of course, if you do submit it!

*** Installing drivers for each function

The other, trickier thing is making Windows install drivers for each
individual function.

For mass storage it is trivial since Windows detect it's an interface
implementing USB Mass Storage class and selects appropriate driver.

Things are harder with RDNIS and CDC ACM.

**** RNDIS

To make Windows select RNDIS drivers for the first function in the
gadget, one needs to use the [[file:linux.inf]] file provided with this
document. It "attaches" Window's RNDIS driver to the first interface
of the gadget.

Please note, that while testing we encountered some issues[6] when
RNDIS was not the first interface. You do not need to worry abut it
unless you are trying to develop your own gadget in which case watch
out for this bug.

**** CDC ACM

Similarly, [[file:linux-cdc-acm.inf]] is provided for CDC ACM.

**** Customising the gadget

If you intend to hack the g_multi gadget be advised that rearranging
functions will obviously change interface numbers for each of the
functionality. As an effect provided INFs won't work since they have
interface numbers hard-coded in them (it's not hard to change those
though[7]).

This also means, that after experimenting with g_multi and changing
provided functions one should change gadget's vendor and/or product ID
so there will be no collision with other customised gadgets or the
original gadget.

Failing to comply may cause brain damage after wondering for hours why
things don't work as intended before realising Windows have cached
some drivers information (changing USB port may sometimes help plus
you might try using USBDeview[8] to remove the phantom device).

**** INF testing

Provided INF files have been tested on Windows XP SP3, Windows Vista
and Windows 7, all 32-bit versions. It should work on 64-bit versions
as well. It most likely won't work on Windows prior to Windows XP
SP2.

** Other systems

At this moment, drivers for any other systems have not been tested.
Knowing how MacOS is based on BSD and BSD is an Open Source it is
believed that it should (read: "I have no idea whether it will") work
out-of-the-box.

For more exotic systems I have even less to say...

Any testing and drivers *are* *welcome*!

* Authors

This document has been written by Michal Nazarewicz
([[mailto:[email protected]]]). INF files have been hacked with
support of Marek Szyprowski ([[mailto:[email protected]]]) and
Xiaofan Chen ([[mailto:[email protected]]]) basing on the MS RNDIS
template[9], Microchip's CDC ACM INF file and David Brownell's
([[mailto:[email protected]]]) original INF files.

* Footnotes

[1] Remote Network Driver Interface Specification,
[[http://msdn.microsoft.com/en-us/library/ee484414.aspx]].

[2] Communications Device Class Abstract Control Model, spec for this
and other USB classes can be found at
[[http://www.usb.org/developers/devclass_docs/]].

[3] CDC Ethernet Control Model.

[4] [[http://msdn.microsoft.com/en-us/library/ff537109(v=VS.85).aspx]]

[5] [[http://msdn.microsoft.com/en-us/library/ff539234(v=VS.85).aspx]]

[6] To put it in some other nice words, Windows failed to respond to
any user input.

[7] You may find [[http://www.cygnal.org/ubb/Forum9/HTML/001050.html]]
useful.

[8] http://www.nirsoft.net/utils/usb_devices_view.html

[9] [[http://msdn.microsoft.com/en-us/library/ff570620.aspx]]
87 changes: 10 additions & 77 deletions Documentation/usb/gadget_serial.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,88 +151,23 @@ instructions below to install the host side driver.

Installing the Windows Host ACM Driver
--------------------------------------
To use the Windows ACM driver you must have the files "gserial.inf"
and "usbser.sys" together in a folder on the Windows machine.

The "gserial.inf" file is given here.

-------------------- CUT HERE --------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%LINUX%
DriverVer=08/17/2004,0.0.2.0
; Copyright (C) 2004 Al Borchers ([email protected])

[Manufacturer]
%LINUX%=GSerialDeviceList

[GSerialDeviceList]
%GSERIAL%=GSerialInstall, USB\VID_0525&PID_A4A7

[DestinationDirs]
DefaultDestDir=10,System32\Drivers

[GSerialInstall]
CopyFiles=GSerialCopyFiles
AddReg=GSerialAddReg

[GSerialCopyFiles]
usbser.sys

[GSerialAddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[GSerialInstall.Services]
AddService = usbser,0x0002,GSerialService

[GSerialService]
DisplayName = %GSERIAL_DISPLAY_NAME%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\usbser.sys
LoadOrderGroup = Base

[Strings]
LINUX = "Linux"
GSERIAL = "Gadget Serial"
GSERIAL_DISPLAY_NAME = "USB Gadget Serial Driver"
-------------------- CUT HERE --------------------

The "usbser.sys" file comes with various versions of Windows.
For example, it can be found on Windows XP typically in

C:\WINDOWS\Driver Cache\i386\driver.cab

Or it can be found on the Windows 98SE CD in the "win98" folder
in the "DRIVER11.CAB" through "DRIVER20.CAB" cab files. You will
need the DOS "expand" program, the Cygwin "cabextract" program, or
a similar program to unpack these cab files and extract "usbser.sys".

For example, to extract "usbser.sys" into the current directory
on Windows XP, open a DOS window and run a command like

expand C:\WINDOWS\Driver~1\i386\driver.cab -F:usbser.sys .

(Thanks to Nishant Kamat for pointing out this DOS command.)
To use the Windows ACM driver you must have the "linux-cdc-acm.inf"
file (provided along this document) which supports all recent versions
of Windows.

When the gadget serial driver is loaded and the USB device connected
to the Windows host with a USB cable, Windows should recognize the
gadget serial device and ask for a driver. Tell Windows to find the
driver in the folder that contains "gserial.inf" and "usbser.sys".
driver in the folder that contains the "linux-cdc-acm.inf" file.

For example, on Windows XP, when the gadget serial device is first
plugged in, the "Found New Hardware Wizard" starts up. Select
"Install from a list or specific location (Advanced)", then on
the next screen select "Include this location in the search" and
enter the path or browse to the folder containing "gserial.inf" and
"usbser.sys". Windows will complain that the Gadget Serial driver
has not passed Windows Logo testing, but select "Continue anyway"
and finish the driver installation.
"Install from a list or specific location (Advanced)", then on the
next screen select "Include this location in the search" and enter the
path or browse to the folder containing the "linux-cdc-acm.inf" file.
Windows will complain that the Gadget Serial driver has not passed
Windows Logo testing, but select "Continue anyway" and finish the
driver installation.

On Windows XP, in the "Device Manager" (under "Control Panel",
"System", "Hardware") expand the "Ports (COM & LPT)" entry and you
Expand Down Expand Up @@ -345,5 +280,3 @@ you should be able to send data back and forth between the gadget
side and host side systems. Anything you type on the terminal
window on the gadget side should appear in the terminal window on
the host side and vice versa.


4 changes: 2 additions & 2 deletions Documentation/usb/hotplug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ immediately usable. That means the system must do many things, including:

- Bind a driver to that device. Bus frameworks do that using a
device driver's probe() routine.

- Tell other subsystems to configure the new device. Print
queues may need to be enabled, networks brought up, disk
partitions mounted, and so on. In some cases these will
Expand Down Expand Up @@ -84,7 +84,7 @@ USB MODUTILS SUPPORT
Current versions of module-init-tools will create a "modules.usbmap" file
which contains the entries from each driver's MODULE_DEVICE_TABLE. Such
files can be used by various user mode policy agents to make sure all the
right driver modules get loaded, either at boot time or later.
right driver modules get loaded, either at boot time or later.

See <linux/usb.h> for full information about such table entries; or look
at existing drivers. Each table entry describes one or more criteria to
Expand Down
Loading

0 comments on commit 9895850

Please sign in to comment.