Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165006
b: refs/heads/master
c: 9b39e9d
h: refs/heads/master
v: v3
  • Loading branch information
Brian Niebuhr authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent fb40fbe commit 602ec5d
Show file tree
Hide file tree
Showing 9 changed files with 700 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 877accca79b706afe5d78b9a92cf4f22919fb2b0
refs/heads/master: 9b39e9ddedeef48569f8aac60a7b4c1fbb127c7d
26 changes: 23 additions & 3 deletions trunk/drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,8 @@ config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
depends on NET
help
This driver implements Ethernet style communication, in either
of two ways:
This driver implements Ethernet style communication, in one of
several ways:

- The "Communication Device Class" (CDC) Ethernet Control Model.
That protocol is often avoided with pure Ethernet adapters, in
Expand All @@ -639,7 +639,11 @@ config USB_ETH
- On hardware can't implement that protocol, a simple CDC subset
is used, placing fewer demands on USB.

RNDIS support is a third option, more demanding than that subset.
- CDC Ethernet Emulation Model (EEM) is a newer standard that has
a simpler interface that can be used by more USB hardware.

RNDIS support is an additional option, more demanding than than
subset.

Within the USB device, this gadget driver exposes a network device
"usbX", where X depends on what other networking devices you have.
Expand Down Expand Up @@ -672,6 +676,22 @@ config USB_ETH_RNDIS
XP, you'll need to download drivers from Microsoft's website; a URL
is given in comments found in that info file.

config USB_ETH_EEM
bool "Ethernet Emulation Model (EEM) support"
depends on USB_ETH
default n
help
CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
and therefore can be supported by more hardware. Technically ECM and
EEM are designed for different applications. The ECM model extends
the network interface to the target (e.g. a USB cable modem), and the
EEM model is for mobile devices to communicate with hosts using
ethernet over USB. For Linux gadgets, however, the interface with
the host is the same (a usbX device), so the differences are minimal.

If you say "y" here, the Ethernet gadget driver will use the EEM
protocol rather than ECM. If unsure, say "n".

config USB_GADGETFS
tristate "Gadget Filesystem (EXPERIMENTAL)"
depends on EXPERIMENTAL
Expand Down
31 changes: 28 additions & 3 deletions trunk/drivers/usb/gadget/ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
* simpler, Microsoft pushes their own approach: RNDIS. The published
* RNDIS specs are ambiguous and appear to be incomplete, and are also
* needlessly complex. They borrow more from CDC ACM than CDC ECM.
*
* While CDC ECM, CDC Subset, and RNDIS are designed to extend the ethernet
* interface to the target, CDC EEM was designed to use ethernet over the USB
* link between the host and target. CDC EEM is implemented as an alternative
* to those other protocols when that communication model is more appropriate
*/

#define DRIVER_DESC "Ethernet Gadget"
Expand Down Expand Up @@ -114,6 +119,7 @@ static inline bool has_rndis(void)
#include "f_rndis.c"
#include "rndis.c"
#endif
#include "f_eem.c"
#include "u_ether.c"

/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -150,6 +156,10 @@ static inline bool has_rndis(void)
#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */

/* For EEM gadgets */
#define EEM_VENDOR_NUM 0x0525 /* INVALID - NEEDS TO BE ALLOCATED */
#define EEM_PRODUCT_NUM 0xa4a1 /* INVALID - NEEDS TO BE ALLOCATED */

/*-------------------------------------------------------------------------*/

static struct usb_device_descriptor device_desc = {
Expand Down Expand Up @@ -246,8 +256,16 @@ static struct usb_configuration rndis_config_driver = {

/*-------------------------------------------------------------------------*/

#ifdef CONFIG_USB_ETH_EEM
static int use_eem = 1;
#else
static int use_eem;
#endif
module_param(use_eem, bool, 0);
MODULE_PARM_DESC(use_eem, "use CDC EEM mode");

/*
* We _always_ have an ECM or CDC Subset configuration.
* We _always_ have an ECM, CDC Subset, or EEM configuration.
*/
static int __init eth_do_config(struct usb_configuration *c)
{
Expand All @@ -258,7 +276,9 @@ static int __init eth_do_config(struct usb_configuration *c)
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
}

if (can_support_ecm(c->cdev->gadget))
if (use_eem)
return eem_bind_config(c);
else if (can_support_ecm(c->cdev->gadget))
return ecm_bind_config(c, hostaddr);
else
return geth_bind_config(c, hostaddr);
Expand Down Expand Up @@ -286,7 +306,12 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
return status;

/* set up main config label and device descriptor */
if (can_support_ecm(cdev->gadget)) {
if (use_eem) {
/* EEM */
eth_config_driver.label = "CDC Ethernet (EEM)";
device_desc.idVendor = cpu_to_le16(EEM_VENDOR_NUM);
device_desc.idProduct = cpu_to_le16(EEM_PRODUCT_NUM);
} else if (can_support_ecm(cdev->gadget)) {
/* ECM */
eth_config_driver.label = "CDC Ethernet (ECM)";
} else {
Expand Down
Loading

0 comments on commit 602ec5d

Please sign in to comment.