Commit 0c7989b9 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Add dummy_hcd to the main kernel

This is a resubmission of as225, together with appropriate changes for the
g_serial driver.  David Brownell's latest g_ether update makes it
unnecessary to change that file or gadget_chips.h.



dummy_hcd is simultaneously a host controller driver and a device
controller driver.  It creates a simulated HC together with a simulated
UDC plugged into it.  Gadget drivers can run under the simulated UDC and
will appear as regular USB devices on the simulated HC.  The simulation is
reasonably (although not totally) realistic.

It's a wonderful tool for testing and developing gadget drivers without
the need for lots of additional hardware: Both the host driver and the
gadget driver can run on the same computer.  It's been available for quite
some time in David's gadget-2.6 tree and it works well.  I couldn't have
gotten the file-storage gadget running in any reasonable length of time
without it.
parent d0d4457b
......@@ -134,6 +134,34 @@ config USB_SA1100
depends on USB_GADGET_SA1100
default USB_GADGET
config USB_GADGET_DUMMY_HCD
boolean "Dummy HCD (DEVELOPMENT)"
depends on USB && EXPERIMENTAL
select USB_GADGET_DUALSPEED
help
This host controller driver emulates USB, looping all data transfer
requests back to a USB "gadget driver" in the same host. The host
side is the master; the gadget side is the slave. Gadget drivers
can be high, full, or low speed; and they have access to endpoints
like those from NET2280, PXA2xx, or SA1100 hardware.
This may help in some stages of creating a driver to embed in a
Linux device, since it lets you debug several parts of the gadget
driver without its hardware or drivers being involved.
Since such a gadget side driver needs to interoperate with a host
side Linux-USB device driver, this may help to debug both sides
of a USB protocol stack.
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "dummy_hcd" and force all
gadget drivers to also be dynamically linked.
config USB_DUMMY_HCD
tristate
depends on USB_GADGET_DUMMY_HCD
default USB_GADGET
endchoice
config USB_GADGET_DUALSPEED
......
#
# USB peripheral controller drivers
#
obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o
obj-$(CONFIG_USB_NET2280) += net2280.o
obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o
obj-$(CONFIG_USB_GOKU) += goku_udc.o
......
This diff is collapsed.
......@@ -206,6 +206,27 @@ static inline void hw_optimize(struct usb_gadget *gadget)
#endif
/*
* Dummy_hcd, software-based loopback controller.
*
* This imitates the abilities of the NetChip 2280, so we will use
* the same configuration.
*/
#ifdef CONFIG_USB_GADGET_DUMMY_HCD
#define CHIP "dummy"
#define EP0_MAXPACKET 64
static const char EP_OUT_NAME[] = "ep-a";
#define EP_OUT_NUM 2
static const char EP_IN_NAME[] = "ep-b";
#define EP_IN_NUM 2
#define HIGHSPEED
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* no hw optimizations to apply */
#define hw_optimize(g) do {} while (0)
#endif
/*
* PXA-2xx UDC: widely used in second gen Linux-capable PDAs.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment