2 * CDC Ethernet based networking peripherals
3 * Copyright (C) 2003-2005 by David Brownell
4 * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 // #define DEBUG // error path messages, extra info
22 // #define VERBOSE // more; success messages
24 #include <linux/module.h>
25 #include <linux/init.h>
26 #include <linux/netdevice.h>
27 #include <linux/etherdevice.h>
28 #include <linux/ethtool.h>
29 #include <linux/workqueue.h>
30 #include <linux/mii.h>
31 #include <linux/usb.h>
32 #include <linux/usb/cdc.h>
33 #include <linux/usb/usbnet.h>
36 #if IS_ENABLED(CONFIG_USB_NET_RNDIS_HOST)
38 static int is_rndis(struct usb_interface_descriptor *desc)
40 return (desc->bInterfaceClass == USB_CLASS_COMM &&
41 desc->bInterfaceSubClass == 2 &&
42 desc->bInterfaceProtocol == 0xff);
45 static int is_activesync(struct usb_interface_descriptor *desc)
47 return (desc->bInterfaceClass == USB_CLASS_MISC &&
48 desc->bInterfaceSubClass == 1 &&
49 desc->bInterfaceProtocol == 1);
52 static int is_wireless_rndis(struct usb_interface_descriptor *desc)
54 return (desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER &&
55 desc->bInterfaceSubClass == 1 &&
56 desc->bInterfaceProtocol == 3);
61 #define is_rndis(desc) 0
62 #define is_activesync(desc) 0
63 #define is_wireless_rndis(desc) 0
67 static const u8 mbm_guid[16] = {
68 0xa3, 0x17, 0xa8, 0x8b, 0x04, 0x5e, 0x4f, 0x01,
69 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
72 /* probes control interface, claims data interface, collects the bulk
73 * endpoints, activates data interface (if needed), maybe sets MTU.
74 * all pure cdc, except for certain firmware workarounds, and knowing
75 * that rndis uses one different rule.
77 int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
79 u8 *buf = intf->cur_altsetting->extra;
80 int len = intf->cur_altsetting->extralen;
81 struct usb_interface_descriptor *d;
82 struct cdc_state *info = (void *) &dev->data;
85 bool android_rndis_quirk = false;
86 struct usb_driver *driver = driver_of(intf);
87 struct usb_cdc_mdlm_desc *desc = NULL;
88 struct usb_cdc_mdlm_detail_desc *detail = NULL;
90 if (sizeof(dev->data) < sizeof(*info))
93 /* expect strict spec conformance for the descriptors, but
94 * cope with firmware which stores them in the wrong place
96 if (len == 0 && dev->udev->actconfig->extralen) {
97 /* Motorola SB4100 (and others: Brad Hards says it's
98 * from a Broadcom design) put CDC descriptors here
100 buf = dev->udev->actconfig->extra;
101 len = dev->udev->actconfig->extralen;
102 dev_dbg(&intf->dev, "CDC descriptors on config\n");
105 /* Maybe CDC descriptors are after the endpoint? This bug has
106 * been seen on some 2Wire Inc RNDIS-ish products.
109 struct usb_host_endpoint *hep;
111 hep = intf->cur_altsetting->endpoint;
118 "CDC descriptors on endpoint\n");
121 /* this assumes that if there's a non-RNDIS vendor variant
122 * of cdc-acm, it'll fail RNDIS requests cleanly.
124 rndis = (is_rndis(&intf->cur_altsetting->desc) ||
125 is_activesync(&intf->cur_altsetting->desc) ||
126 is_wireless_rndis(&intf->cur_altsetting->desc));
128 memset(info, 0, sizeof(*info));
129 info->control = intf;
131 if (buf[1] != USB_DT_CS_INTERFACE)
134 /* use bDescriptorSubType to identify the CDC descriptors.
135 * We expect devices with CDC header and union descriptors.
136 * For CDC Ethernet we need the ethernet descriptor.
137 * For RNDIS, ignore two (pointless) CDC modem descriptors
138 * in favor of a complicated OID-based RPC scheme doing what
139 * CDC Ethernet achieves with a simple descriptor.
142 case USB_CDC_HEADER_TYPE:
144 dev_dbg(&intf->dev, "extra CDC header\n");
147 info->header = (void *) buf;
148 if (info->header->bLength != sizeof(*info->header)) {
149 dev_dbg(&intf->dev, "CDC header len %u\n",
150 info->header->bLength);
154 case USB_CDC_ACM_TYPE:
155 /* paranoia: disambiguate a "real" vendor-specific
156 * modem interface from an RNDIS non-modem.
159 struct usb_cdc_acm_descriptor *acm;
162 if (acm->bmCapabilities) {
164 "ACM capabilities %02x, "
165 "not really RNDIS?\n",
166 acm->bmCapabilities);
171 case USB_CDC_UNION_TYPE:
173 dev_dbg(&intf->dev, "extra CDC union\n");
176 info->u = (void *) buf;
177 if (info->u->bLength != sizeof(*info->u)) {
178 dev_dbg(&intf->dev, "CDC union len %u\n",
183 /* we need a master/control interface (what we're
184 * probed with) and a slave/data interface; union
185 * descriptors sort this all out.
187 info->control = usb_ifnum_to_if(dev->udev,
188 info->u->bMasterInterface0);
189 info->data = usb_ifnum_to_if(dev->udev,
190 info->u->bSlaveInterface0);
191 if (!info->control || !info->data) {
193 "master #%u/%p slave #%u/%p\n",
194 info->u->bMasterInterface0,
196 info->u->bSlaveInterface0,
198 /* fall back to hard-wiring for RNDIS */
200 android_rndis_quirk = true;
205 if (info->control != intf) {
206 dev_dbg(&intf->dev, "bogus CDC Union\n");
207 /* Ambit USB Cable Modem (and maybe others)
208 * interchanges master and slave interface.
210 if (info->data == intf) {
211 info->data = info->control;
212 info->control = intf;
217 /* some devices merge these - skip class check */
218 if (info->control == info->data)
221 /* a data interface altsetting does the real i/o */
222 d = &info->data->cur_altsetting->desc;
223 if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
224 dev_dbg(&intf->dev, "slave class %u\n",
229 case USB_CDC_ETHERNET_TYPE:
231 dev_dbg(&intf->dev, "extra CDC ether\n");
234 info->ether = (void *) buf;
235 if (info->ether->bLength != sizeof(*info->ether)) {
236 dev_dbg(&intf->dev, "CDC ether len %u\n",
237 info->ether->bLength);
240 dev->hard_mtu = le16_to_cpu(
241 info->ether->wMaxSegmentSize);
242 /* because of Zaurus, we may be ignoring the host
243 * side link address we were given.
246 case USB_CDC_MDLM_TYPE:
248 dev_dbg(&intf->dev, "extra MDLM descriptor\n");
254 if (desc->bLength != sizeof(*desc))
257 if (memcmp(&desc->bGUID, mbm_guid, 16))
260 case USB_CDC_MDLM_DETAIL_TYPE:
262 dev_dbg(&intf->dev, "extra MDLM detail descriptor\n");
266 detail = (void *)buf;
268 if (detail->bGuidDescriptorType == 0) {
269 if (detail->bLength < (sizeof(*detail) + 1))
276 len -= buf[0]; /* bLength */
280 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
281 * CDC descriptors, so we'll hard-wire the interfaces and not check
284 * Some Android RNDIS devices have a CDC Union descriptor pointing
285 * to non-existing interfaces. Ignore that and attempt the same
286 * hard-wired 0 and 1 interfaces.
288 if (rndis && (!info->u || android_rndis_quirk)) {
289 info->control = usb_ifnum_to_if(dev->udev, 0);
290 info->data = usb_ifnum_to_if(dev->udev, 1);
291 if (!info->control || !info->data || info->control != intf) {
293 "rndis: master #0/%p slave #1/%p\n",
299 } else if (!info->header || !info->u || (!rndis && !info->ether)) {
300 dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
301 info->header ? "" : "header ",
302 info->u ? "" : "union ",
303 info->ether ? "" : "ether ");
307 /* claim data interface and set it up ... with side effects.
308 * network traffic can't flow until an altsetting is enabled.
310 if (info->data != info->control) {
311 status = usb_driver_claim_interface(driver, info->data, dev);
315 status = usbnet_get_endpoints(dev, info->data);
317 /* ensure immediate exit from usbnet_disconnect */
318 usb_set_intfdata(info->data, NULL);
319 if (info->data != info->control)
320 usb_driver_release_interface(driver, info->data);
324 /* status endpoint: optional for CDC Ethernet, not RNDIS (or ACM) */
325 if (info->data != info->control)
327 if (info->control->cur_altsetting->desc.bNumEndpoints == 1) {
328 struct usb_endpoint_descriptor *desc;
330 dev->status = &info->control->cur_altsetting->endpoint [0];
331 desc = &dev->status->desc;
332 if (!usb_endpoint_is_int_in(desc) ||
333 (le16_to_cpu(desc->wMaxPacketSize)
334 < sizeof(struct usb_cdc_notification)) ||
336 dev_dbg(&intf->dev, "bad notification endpoint\n");
340 if (rndis && !dev->status) {
341 dev_dbg(&intf->dev, "missing RNDIS status endpoint\n");
342 usb_set_intfdata(info->data, NULL);
343 usb_driver_release_interface(driver, info->data);
349 dev_info(&dev->udev->dev, "bad CDC descriptors\n");
352 EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
354 void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
356 struct cdc_state *info = (void *) &dev->data;
357 struct usb_driver *driver = driver_of(intf);
359 /* combined interface - nothing to do */
360 if (info->data == info->control)
363 /* disconnect master --> disconnect slave */
364 if (intf == info->control && info->data) {
365 /* ensure immediate exit from usbnet_disconnect */
366 usb_set_intfdata(info->data, NULL);
367 usb_driver_release_interface(driver, info->data);
371 /* and vice versa (just in case) */
372 else if (intf == info->data && info->control) {
373 /* ensure immediate exit from usbnet_disconnect */
374 usb_set_intfdata(info->control, NULL);
375 usb_driver_release_interface(driver, info->control);
376 info->control = NULL;
379 EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
381 /* Communications Device Class, Ethernet Control model
383 * Takes two interfaces. The DATA interface is inactive till an altsetting
384 * is selected. Configuration data includes class descriptors. There's
385 * an optional status endpoint on the control interface.
387 * This should interop with whatever the 2.4 "CDCEther.c" driver
388 * (by Brad Hards) talked with, with more functionality.
391 static void dumpspeed(struct usbnet *dev, __le32 *speeds)
393 netif_info(dev, timer, dev->net,
394 "link speeds: %u kbps up, %u kbps down\n",
395 __le32_to_cpu(speeds[0]) / 1000,
396 __le32_to_cpu(speeds[1]) / 1000);
399 void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
401 struct usb_cdc_notification *event;
403 if (urb->actual_length < sizeof(*event))
406 /* SPEED_CHANGE can get split into two 8-byte packets */
407 if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) {
408 dumpspeed(dev, (__le32 *) urb->transfer_buffer);
412 event = urb->transfer_buffer;
413 switch (event->bNotificationType) {
414 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
415 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
416 event->wValue ? "on" : "off");
417 usbnet_link_change(dev, !!event->wValue, 0);
419 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
420 netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
422 if (urb->actual_length != (sizeof(*event) + 8))
423 set_bit(EVENT_STS_SPLIT, &dev->flags);
425 dumpspeed(dev, (__le32 *) &event[1]);
427 /* USB_CDC_NOTIFY_RESPONSE_AVAILABLE can happen too (e.g. RNDIS),
428 * but there are no standard formats for the response data.
431 netdev_err(dev->net, "CDC: unexpected notification %02x!\n",
432 event->bNotificationType);
436 EXPORT_SYMBOL_GPL(usbnet_cdc_status);
438 int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
441 struct cdc_state *info = (void *) &dev->data;
443 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
444 < sizeof(struct cdc_state)));
446 status = usbnet_generic_cdc_bind(dev, intf);
450 status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress);
452 usb_set_intfdata(info->data, NULL);
453 usb_driver_release_interface(driver_of(intf), info->data);
457 /* FIXME cdc-ether has some multicast code too, though it complains
458 * in routine cases. info->ether describes the multicast support.
459 * Implement that here, manipulating the cdc filter as needed.
463 EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
465 static const struct driver_info cdc_info = {
466 .description = "CDC Ethernet Device",
467 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
468 .bind = usbnet_cdc_bind,
469 .unbind = usbnet_cdc_unbind,
470 .status = usbnet_cdc_status,
471 .manage_power = usbnet_manage_power,
474 static const struct driver_info wwan_info = {
475 .description = "Mobile Broadband Network Device",
477 .bind = usbnet_cdc_bind,
478 .unbind = usbnet_cdc_unbind,
479 .status = usbnet_cdc_status,
480 .manage_power = usbnet_manage_power,
483 /*-------------------------------------------------------------------------*/
485 #define HUAWEI_VENDOR_ID 0x12D1
486 #define NOVATEL_VENDOR_ID 0x1410
487 #define ZTE_VENDOR_ID 0x19D2
488 #define DELL_VENDOR_ID 0x413C
489 #define REALTEK_VENDOR_ID 0x0bda
491 static const struct usb_device_id products[] = {
494 * First blacklist any products that are egregiously nonconformant
495 * with the CDC Ethernet specs. Minor braindamage we cope with; when
496 * they're not even trying, needing a separate driver is only the first
497 * of the differences to show up.
500 #define ZAURUS_MASTER_INTERFACE \
501 .bInterfaceClass = USB_CLASS_COMM, \
502 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
503 .bInterfaceProtocol = USB_CDC_PROTO_NONE
505 /* SA-1100 based Sharp Zaurus ("collie"), or compatible;
506 * wire-incompatible with true CDC Ethernet implementations.
507 * (And, it seems, needlessly so...)
510 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
511 | USB_DEVICE_ID_MATCH_DEVICE,
514 ZAURUS_MASTER_INTERFACE,
518 /* PXA-25x based Sharp Zaurii. Note that it seems some of these
519 * (later models especially) may have shipped only with firmware
520 * advertising false "CDC MDLM" compatibility ... but we're not
521 * clear which models did that, so for now let's assume the worst.
524 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
525 | USB_DEVICE_ID_MATCH_DEVICE,
527 .idProduct = 0x8005, /* A-300 */
528 ZAURUS_MASTER_INTERFACE,
531 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
532 | USB_DEVICE_ID_MATCH_DEVICE,
534 .idProduct = 0x8006, /* B-500/SL-5600 */
535 ZAURUS_MASTER_INTERFACE,
538 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
539 | USB_DEVICE_ID_MATCH_DEVICE,
541 .idProduct = 0x8007, /* C-700 */
542 ZAURUS_MASTER_INTERFACE,
545 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
546 | USB_DEVICE_ID_MATCH_DEVICE,
548 .idProduct = 0x9031, /* C-750 C-760 */
549 ZAURUS_MASTER_INTERFACE,
552 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
553 | USB_DEVICE_ID_MATCH_DEVICE,
555 .idProduct = 0x9032, /* SL-6000 */
556 ZAURUS_MASTER_INTERFACE,
559 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
560 | USB_DEVICE_ID_MATCH_DEVICE,
562 /* reported with some C860 units */
563 .idProduct = 0x9050, /* C-860 */
564 ZAURUS_MASTER_INTERFACE,
568 /* Olympus has some models with a Zaurus-compatible option.
569 * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
572 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
573 | USB_DEVICE_ID_MATCH_DEVICE,
575 .idProduct = 0x0F02, /* R-1000 */
576 ZAURUS_MASTER_INTERFACE,
580 /* LG Electronics VL600 wants additional headers on every frame */
582 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
583 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
587 /* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
589 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
590 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
594 /* Novatel USB551L and MC551 - handled by qmi_wwan */
596 USB_DEVICE_AND_INTERFACE_INFO(NOVATEL_VENDOR_ID, 0xB001, USB_CLASS_COMM,
597 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
601 /* Novatel E362 - handled by qmi_wwan */
603 USB_DEVICE_AND_INTERFACE_INFO(NOVATEL_VENDOR_ID, 0x9010, USB_CLASS_COMM,
604 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
608 /* Dell Wireless 5800 (Novatel E362) - handled by qmi_wwan */
610 USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, 0x8195, USB_CLASS_COMM,
611 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
615 /* Dell Wireless 5800 (Novatel E362) - handled by qmi_wwan */
617 USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, 0x8196, USB_CLASS_COMM,
618 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
622 /* Dell Wireless 5804 (Novatel E371) - handled by qmi_wwan */
624 USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, 0x819b, USB_CLASS_COMM,
625 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
629 /* AnyDATA ADU960S - handled by qmi_wwan */
631 USB_DEVICE_AND_INTERFACE_INFO(0x16d5, 0x650a, USB_CLASS_COMM,
632 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
636 /* Huawei E1820 - handled by qmi_wwan */
638 USB_DEVICE_INTERFACE_NUMBER(HUAWEI_VENDOR_ID, 0x14ac, 1),
642 /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */
644 USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8152, USB_CLASS_COMM,
645 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
649 /* Realtek RTL8153 Based USB 3.0 Ethernet Adapters */
651 USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8153, USB_CLASS_COMM,
652 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
658 * CDC Ether uses two interfaces, not necessarily consecutive.
659 * We match the main interface, ignoring the optional device
660 * class so we could handle devices that aren't exclusively
663 * NOTE: this match must come AFTER entries blacklisting devices
664 * because of bugs/quirks in a given product (like Zaurus, above).
667 /* ZTE (Vodafone) K3805-Z */
668 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
669 | USB_DEVICE_ID_MATCH_PRODUCT
670 | USB_DEVICE_ID_MATCH_INT_INFO,
671 .idVendor = ZTE_VENDOR_ID,
673 .bInterfaceClass = USB_CLASS_COMM,
674 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
675 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
676 .driver_info = (unsigned long)&wwan_info,
678 /* ZTE (Vodafone) K3806-Z */
679 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
680 | USB_DEVICE_ID_MATCH_PRODUCT
681 | USB_DEVICE_ID_MATCH_INT_INFO,
682 .idVendor = ZTE_VENDOR_ID,
684 .bInterfaceClass = USB_CLASS_COMM,
685 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
686 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
687 .driver_info = (unsigned long)&wwan_info,
689 /* ZTE (Vodafone) K4510-Z */
690 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
691 | USB_DEVICE_ID_MATCH_PRODUCT
692 | USB_DEVICE_ID_MATCH_INT_INFO,
693 .idVendor = ZTE_VENDOR_ID,
695 .bInterfaceClass = USB_CLASS_COMM,
696 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
697 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
698 .driver_info = (unsigned long)&wwan_info,
700 /* ZTE (Vodafone) K3770-Z */
701 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
702 | USB_DEVICE_ID_MATCH_PRODUCT
703 | USB_DEVICE_ID_MATCH_INT_INFO,
704 .idVendor = ZTE_VENDOR_ID,
706 .bInterfaceClass = USB_CLASS_COMM,
707 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
708 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
709 .driver_info = (unsigned long)&wwan_info,
711 /* ZTE (Vodafone) K3772-Z */
712 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
713 | USB_DEVICE_ID_MATCH_PRODUCT
714 | USB_DEVICE_ID_MATCH_INT_INFO,
715 .idVendor = ZTE_VENDOR_ID,
717 .bInterfaceClass = USB_CLASS_COMM,
718 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
719 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
720 .driver_info = (unsigned long)&wwan_info,
723 USB_VENDOR_AND_INTERFACE_INFO(0x1bc7, USB_CLASS_COMM,
724 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
725 .driver_info = (kernel_ulong_t) &wwan_info,
727 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
729 .driver_info = (unsigned long) &cdc_info,
731 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
733 .driver_info = (unsigned long)&wwan_info,
736 /* Various Huawei modems with a network port like the UMG1831 */
737 .match_flags = USB_DEVICE_ID_MATCH_VENDOR
738 | USB_DEVICE_ID_MATCH_INT_INFO,
739 .idVendor = HUAWEI_VENDOR_ID,
740 .bInterfaceClass = USB_CLASS_COMM,
741 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
742 .bInterfaceProtocol = 255,
743 .driver_info = (unsigned long)&wwan_info,
747 MODULE_DEVICE_TABLE(usb, products);
749 static struct usb_driver cdc_driver = {
751 .id_table = products,
752 .probe = usbnet_probe,
753 .disconnect = usbnet_disconnect,
754 .suspend = usbnet_suspend,
755 .resume = usbnet_resume,
756 .reset_resume = usbnet_resume,
757 .supports_autosuspend = 1,
758 .disable_hub_initiated_lpm = 1,
761 module_usb_driver(cdc_driver);
763 MODULE_AUTHOR("David Brownell");
764 MODULE_DESCRIPTION("USB CDC Ethernet devices");
765 MODULE_LICENSE("GPL");