2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* ether.c -- Ethernet gadget driver, with CDC and non-CDC options
|
|
|
|
*
|
2008-06-20 09:20:11 +08:00
|
|
|
* Copyright (C) 2003-2005,2008 David Brownell
|
2005-04-17 06:20:36 +08:00
|
|
|
* Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger
|
2008-06-20 09:20:11 +08:00
|
|
|
* Copyright (C) 2008 Nokia Corporation
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2007-08-02 15:00:38 +08:00
|
|
|
/* #define VERBOSE_DEBUG */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/utsname.h>
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
#include "u_ether.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ethernet gadget driver -- with CDC and non-CDC options
|
|
|
|
* Builds on hardware support for a full duplex link.
|
|
|
|
*
|
|
|
|
* CDC Ethernet is the standard USB solution for sending Ethernet frames
|
|
|
|
* using USB. Real hardware tends to use the same framing protocol but look
|
|
|
|
* different for control features. This driver strongly prefers to use
|
|
|
|
* this USB-IF standard as its open-systems interoperability solution;
|
|
|
|
* most host side USB stacks (except from Microsoft) support it.
|
|
|
|
*
|
2008-06-20 09:20:11 +08:00
|
|
|
* This is sometimes called "CDC ECM" (Ethernet Control Model) to support
|
|
|
|
* TLA-soup. "CDC ACM" (Abstract Control Model) is for modems, and a new
|
|
|
|
* "CDC EEM" (Ethernet Emulation Model) is starting to spread.
|
|
|
|
*
|
|
|
|
* There's some hardware that can't talk CDC ECM. We make that hardware
|
2005-04-17 06:20:36 +08:00
|
|
|
* implement a "minimalist" vendor-agnostic CDC core: same framing, but
|
2006-12-12 07:59:04 +08:00
|
|
|
* link-level setup only requires activating the configuration. Only the
|
|
|
|
* endpoint descriptors, and product/vendor IDs, are relevant; no control
|
|
|
|
* operations are available. Linux supports it, but other host operating
|
|
|
|
* systems may not. (This is a subset of CDC Ethernet.)
|
|
|
|
*
|
|
|
|
* It turns out that if you add a few descriptors to that "CDC Subset",
|
|
|
|
* (Windows) host side drivers from MCCI can treat it as one submode of
|
|
|
|
* a proprietary scheme called "SAFE" ... without needing to know about
|
|
|
|
* specific product/vendor IDs. So we do that, making it easier to use
|
|
|
|
* those MS-Windows drivers. Those added descriptors make it resemble a
|
|
|
|
* CDC MDLM device, but they don't change device behavior at all. (See
|
|
|
|
* MCCI Engineering report 950198 "SAFE Networking Functions".)
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* A third option is also in use. Rather than CDC Ethernet, or something
|
|
|
|
* simpler, Microsoft pushes their own approach: RNDIS. The published
|
|
|
|
* RNDIS specs are ambiguous and appear to be incomplete, and are also
|
2008-06-20 09:20:11 +08:00
|
|
|
* needlessly complex. They borrow more from CDC ACM than CDC ECM.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DRIVER_DESC "Ethernet Gadget"
|
2008-06-20 09:20:11 +08:00
|
|
|
#define DRIVER_VERSION "Memorial Day 2008"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
#ifdef CONFIG_USB_ETH_RNDIS
|
|
|
|
#define PREFIX "RNDIS/"
|
|
|
|
#else
|
|
|
|
#define PREFIX ""
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*
|
|
|
|
* This driver aims for interoperability by using CDC ECM unless
|
|
|
|
*
|
|
|
|
* can_support_ecm()
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2008-06-20 09:20:11 +08:00
|
|
|
* returns false, in which case it supports the CDC Subset. By default,
|
|
|
|
* that returns true; most hardware has no problems with CDC ECM, that's
|
|
|
|
* a good default. Previous versions of this driver had no default; this
|
|
|
|
* version changes that, removing overhead for new controller support.
|
|
|
|
*
|
|
|
|
* IF YOUR HARDWARE CAN'T SUPPORT CDC ECM, UPDATE THAT ROUTINE!
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static inline bool has_rndis(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_USB_ETH_RNDIS
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
2008-08-19 08:45:07 +08:00
|
|
|
/*
|
|
|
|
* Kbuild is not very cooperative with respect to linking separately
|
|
|
|
* compiled library objects into one module. So for now we won't use
|
|
|
|
* separate compilation ... ensuring init/exit sections work to shrink
|
|
|
|
* the runtime footprint, and giving us at least some parts of what
|
|
|
|
* a "gcc --combine ... part1.c part2.c part3.c ... " build would.
|
|
|
|
*/
|
|
|
|
#include "composite.c"
|
|
|
|
#include "usbstring.c"
|
|
|
|
#include "config.c"
|
|
|
|
#include "epautoconf.c"
|
|
|
|
|
|
|
|
#include "f_ecm.c"
|
|
|
|
#include "f_subset.c"
|
|
|
|
#ifdef CONFIG_USB_ETH_RNDIS
|
|
|
|
#include "f_rndis.c"
|
|
|
|
#include "rndis.c"
|
|
|
|
#endif
|
|
|
|
#include "u_ether.c"
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
|
|
|
|
* Instead: allocate your own, using normal USB-IF procedures.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Thanks to NetChip Technologies for donating this product ID.
|
|
|
|
* It's for devices with only CDC Ethernet configurations.
|
|
|
|
*/
|
2008-06-20 09:20:11 +08:00
|
|
|
#define CDC_VENDOR_NUM 0x0525 /* NetChip */
|
|
|
|
#define CDC_PRODUCT_NUM 0xa4a1 /* Linux-USB Ethernet Gadget */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* For hardware that can't talk CDC, we use the same vendor ID that
|
|
|
|
* ARM Linux has used for ethernet-over-usb, both with sa1100 and
|
|
|
|
* with pxa250. We're protocol-compatible, if the host-side drivers
|
|
|
|
* use the endpoint descriptors. bcdDevice (version) is nonzero, so
|
|
|
|
* drivers that need to hard-wire endpoint numbers have a hook.
|
|
|
|
*
|
|
|
|
* The protocol is a minimal subset of CDC Ether, which works on any bulk
|
|
|
|
* hardware that's not deeply broken ... even on hardware that can't talk
|
|
|
|
* RNDIS (like SA-1100, with no interrupt endpoint, or anything that
|
|
|
|
* doesn't handle control-OUT).
|
|
|
|
*/
|
|
|
|
#define SIMPLE_VENDOR_NUM 0x049f
|
|
|
|
#define SIMPLE_PRODUCT_NUM 0x505a
|
|
|
|
|
|
|
|
/* For hardware that can talk RNDIS and either of the above protocols,
|
|
|
|
* use this ID ... the windows INF files will know it. Unless it's
|
|
|
|
* used with CDC Ethernet, Linux 2.4 hosts will need updates to choose
|
|
|
|
* the non-RNDIS configuration.
|
|
|
|
*/
|
|
|
|
#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
|
|
|
|
#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_device_descriptor device_desc = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.bLength = sizeof device_desc,
|
|
|
|
.bDescriptorType = USB_DT_DEVICE,
|
|
|
|
|
2009-02-12 06:11:36 +08:00
|
|
|
.bcdUSB = cpu_to_le16 (0x0200),
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
.bDeviceClass = USB_CLASS_COMM,
|
|
|
|
.bDeviceSubClass = 0,
|
|
|
|
.bDeviceProtocol = 0,
|
2008-06-20 09:20:11 +08:00
|
|
|
/* .bMaxPacketSize0 = f(hardware) */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* Vendor and product id defaults change according to what configs
|
|
|
|
* we support. (As does bNumConfigurations.) These values can
|
|
|
|
* also be overridden by module parameters.
|
|
|
|
*/
|
2009-02-12 06:11:36 +08:00
|
|
|
.idVendor = cpu_to_le16 (CDC_VENDOR_NUM),
|
|
|
|
.idProduct = cpu_to_le16 (CDC_PRODUCT_NUM),
|
2008-06-20 09:20:11 +08:00
|
|
|
/* .bcdDevice = f(hardware) */
|
|
|
|
/* .iManufacturer = DYNAMIC */
|
|
|
|
/* .iProduct = DYNAMIC */
|
|
|
|
/* NO SERIAL NUMBER */
|
2005-04-17 06:20:36 +08:00
|
|
|
.bNumConfigurations = 1,
|
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_otg_descriptor otg_descriptor = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.bLength = sizeof otg_descriptor,
|
|
|
|
.bDescriptorType = USB_DT_OTG,
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* REVISIT SRP-only hardware is possible, although
|
|
|
|
* it would not be called "OTG" ...
|
|
|
|
*/
|
|
|
|
.bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
2006-06-14 00:54:40 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static const struct usb_descriptor_header *otg_desc[] = {
|
|
|
|
(struct usb_descriptor_header *) &otg_descriptor,
|
|
|
|
NULL,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* string IDs are assigned dynamically */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
#define STRING_MANUFACTURER_IDX 0
|
|
|
|
#define STRING_PRODUCT_IDX 1
|
2006-12-12 07:59:04 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static char manufacturer[50];
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_string strings_dev[] = {
|
|
|
|
[STRING_MANUFACTURER_IDX].s = manufacturer,
|
|
|
|
[STRING_PRODUCT_IDX].s = PREFIX DRIVER_DESC,
|
|
|
|
{ } /* end of list */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_gadget_strings stringtab_dev = {
|
|
|
|
.language = 0x0409, /* en-us */
|
|
|
|
.strings = strings_dev,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_gadget_strings *dev_strings[] = {
|
|
|
|
&stringtab_dev,
|
|
|
|
NULL,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static u8 hostaddr[ETH_ALEN];
|
2006-12-12 07:59:04 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*-------------------------------------------------------------------------*/
|
2006-12-12 07:59:04 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*
|
|
|
|
* We may not have an RNDIS configuration, but if we do it needs to be
|
|
|
|
* the first one present. That's to make Microsoft's drivers happy,
|
|
|
|
* and to follow DOCSIS 1.0 (cable modem standard).
|
2006-12-12 07:59:04 +08:00
|
|
|
*/
|
2008-06-20 09:20:11 +08:00
|
|
|
static int __init rndis_do_config(struct usb_configuration *c)
|
|
|
|
{
|
|
|
|
/* FIXME alloc iConfiguration string, set it in c->strings */
|
2006-12-12 07:59:04 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
if (gadget_is_otg(c->cdev->gadget)) {
|
|
|
|
c->descriptors = otg_desc;
|
|
|
|
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
return rndis_bind_config(c, hostaddr);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_configuration rndis_config_driver = {
|
|
|
|
.label = "RNDIS",
|
|
|
|
.bind = rndis_do_config,
|
|
|
|
.bConfigurationValue = 2,
|
|
|
|
/* .iConfiguration = DYNAMIC */
|
|
|
|
.bmAttributes = USB_CONFIG_ATT_SELFPOWER,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*-------------------------------------------------------------------------*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*
|
|
|
|
* We _always_ have an ECM or CDC Subset configuration.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-06-20 09:20:11 +08:00
|
|
|
static int __init eth_do_config(struct usb_configuration *c)
|
|
|
|
{
|
|
|
|
/* FIXME alloc iConfiguration string, set it in c->strings */
|
2006-06-14 00:54:40 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
if (gadget_is_otg(c->cdev->gadget)) {
|
|
|
|
c->descriptors = otg_desc;
|
|
|
|
c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
if (can_support_ecm(c->cdev->gadget))
|
|
|
|
return ecm_bind_config(c, hostaddr);
|
|
|
|
else
|
|
|
|
return geth_bind_config(c, hostaddr);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_configuration eth_config_driver = {
|
|
|
|
/* .label = f(hardware) */
|
|
|
|
.bind = eth_do_config,
|
|
|
|
.bConfigurationValue = 1,
|
|
|
|
/* .iConfiguration = DYNAMIC */
|
|
|
|
.bmAttributes = USB_CONFIG_ATT_SELFPOWER,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/*-------------------------------------------------------------------------*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static int __init eth_bind(struct usb_composite_dev *cdev)
|
|
|
|
{
|
|
|
|
int gcnum;
|
|
|
|
struct usb_gadget *gadget = cdev->gadget;
|
|
|
|
int status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* set up network link layer */
|
|
|
|
status = gether_setup(cdev->gadget, hostaddr);
|
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* set up main config label and device descriptor */
|
|
|
|
if (can_support_ecm(cdev->gadget)) {
|
|
|
|
/* ECM */
|
|
|
|
eth_config_driver.label = "CDC Ethernet (ECM)";
|
|
|
|
} else {
|
|
|
|
/* CDC Subset */
|
|
|
|
eth_config_driver.label = "CDC Subset/SAFE";
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM),
|
|
|
|
device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM),
|
|
|
|
device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
if (has_rndis()) {
|
|
|
|
/* RNDIS plus ECM-or-Subset */
|
|
|
|
device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM),
|
|
|
|
device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM),
|
|
|
|
device_desc.bNumConfigurations = 2;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
gcnum = usb_gadget_controller_number(gadget);
|
|
|
|
if (gcnum >= 0)
|
|
|
|
device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum);
|
|
|
|
else {
|
|
|
|
/* We assume that can_support_ecm() tells the truth;
|
|
|
|
* but if the controller isn't recognized at all then
|
|
|
|
* that assumption is a bit more likely to be wrong.
|
|
|
|
*/
|
2008-08-19 08:45:07 +08:00
|
|
|
dev_warn(&gadget->dev,
|
|
|
|
"controller '%s' not recognized; trying %s\n",
|
2008-06-20 09:20:11 +08:00
|
|
|
gadget->name,
|
|
|
|
eth_config_driver.label);
|
|
|
|
device_desc.bcdDevice =
|
2009-02-12 06:11:36 +08:00
|
|
|
cpu_to_le16(0x0300 | 0x0099);
|
2008-06-20 09:20:11 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* Allocate string descriptor numbers ... note that string
|
|
|
|
* contents can be overridden by the composite_dev glue.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* device descriptor strings: manufacturer, product */
|
|
|
|
snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
|
|
|
|
init_utsname()->sysname, init_utsname()->release,
|
|
|
|
gadget->name);
|
|
|
|
status = usb_string_id(cdev);
|
|
|
|
if (status < 0)
|
|
|
|
goto fail;
|
|
|
|
strings_dev[STRING_MANUFACTURER_IDX].id = status;
|
|
|
|
device_desc.iManufacturer = status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
status = usb_string_id(cdev);
|
|
|
|
if (status < 0)
|
|
|
|
goto fail;
|
|
|
|
strings_dev[STRING_PRODUCT_IDX].id = status;
|
|
|
|
device_desc.iProduct = status;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
/* register our configuration(s); RNDIS first, if it's used */
|
|
|
|
if (has_rndis()) {
|
|
|
|
status = usb_add_config(cdev, &rndis_config_driver);
|
|
|
|
if (status < 0)
|
|
|
|
goto fail;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
status = usb_add_config(cdev, ð_config_driver);
|
|
|
|
if (status < 0)
|
|
|
|
goto fail;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-08-19 08:45:07 +08:00
|
|
|
dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
|
|
|
|
DRIVER_DESC);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
fail:
|
|
|
|
gether_cleanup();
|
|
|
|
return status;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static int __exit eth_unbind(struct usb_composite_dev *cdev)
|
|
|
|
{
|
|
|
|
gether_cleanup();
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static struct usb_composite_driver eth_driver = {
|
|
|
|
.name = "g_ether",
|
|
|
|
.dev = &device_desc,
|
|
|
|
.strings = dev_strings,
|
|
|
|
.bind = eth_bind,
|
|
|
|
.unbind = __exit_p(eth_unbind),
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
MODULE_DESCRIPTION(PREFIX DRIVER_DESC);
|
|
|
|
MODULE_AUTHOR("David Brownell, Benedikt Spanger");
|
|
|
|
MODULE_LICENSE("GPL");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static int __init init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2008-06-20 09:20:11 +08:00
|
|
|
return usb_composite_register(ð_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-06-20 09:20:11 +08:00
|
|
|
module_init(init);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-20 09:20:11 +08:00
|
|
|
static void __exit cleanup(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2008-06-20 09:20:11 +08:00
|
|
|
usb_composite_unregister(ð_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-06-20 09:20:11 +08:00
|
|
|
module_exit(cleanup);
|