cdc_ether.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. * CDC Ethernet based networking peripherals
  3. * Copyright (C) 2003-2005 by David Brownell
  4. * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
  5. *
  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.
  10. *
  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.
  15. *
  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
  19. */
  20. // #define DEBUG // error path messages, extra info
  21. // #define VERBOSE // more; success messages
  22. #include <linux/module.h>
  23. #include <linux/init.h>
  24. #include <linux/netdevice.h>
  25. #include <linux/etherdevice.h>
  26. #include <linux/ethtool.h>
  27. #include <linux/workqueue.h>
  28. #include <linux/mii.h>
  29. #include <linux/usb.h>
  30. #include <linux/usb/cdc.h>
  31. #include <linux/usb/usbnet.h>
  32. #if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
  33. static int is_rndis(struct usb_interface_descriptor *desc)
  34. {
  35. return (desc->bInterfaceClass == USB_CLASS_COMM &&
  36. desc->bInterfaceSubClass == 2 &&
  37. desc->bInterfaceProtocol == 0xff);
  38. }
  39. static int is_activesync(struct usb_interface_descriptor *desc)
  40. {
  41. return (desc->bInterfaceClass == USB_CLASS_MISC &&
  42. desc->bInterfaceSubClass == 1 &&
  43. desc->bInterfaceProtocol == 1);
  44. }
  45. static int is_wireless_rndis(struct usb_interface_descriptor *desc)
  46. {
  47. return (desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER &&
  48. desc->bInterfaceSubClass == 1 &&
  49. desc->bInterfaceProtocol == 3);
  50. }
  51. #else
  52. #define is_rndis(desc) 0
  53. #define is_activesync(desc) 0
  54. #define is_wireless_rndis(desc) 0
  55. #endif
  56. /*
  57. * probes control interface, claims data interface, collects the bulk
  58. * endpoints, activates data interface (if needed), maybe sets MTU.
  59. * all pure cdc, except for certain firmware workarounds, and knowing
  60. * that rndis uses one different rule.
  61. */
  62. int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
  63. {
  64. u8 *buf = intf->cur_altsetting->extra;
  65. int len = intf->cur_altsetting->extralen;
  66. struct usb_interface_descriptor *d;
  67. struct cdc_state *info = (void *) &dev->data;
  68. int status;
  69. int rndis;
  70. struct usb_driver *driver = driver_of(intf);
  71. if (sizeof dev->data < sizeof *info)
  72. return -EDOM;
  73. /* expect strict spec conformance for the descriptors, but
  74. * cope with firmware which stores them in the wrong place
  75. */
  76. if (len == 0 && dev->udev->actconfig->extralen) {
  77. /* Motorola SB4100 (and others: Brad Hards says it's
  78. * from a Broadcom design) put CDC descriptors here
  79. */
  80. buf = dev->udev->actconfig->extra;
  81. len = dev->udev->actconfig->extralen;
  82. if (len)
  83. dev_dbg(&intf->dev,
  84. "CDC descriptors on config\n");
  85. }
  86. /* Maybe CDC descriptors are after the endpoint? This bug has
  87. * been seen on some 2Wire Inc RNDIS-ish products.
  88. */
  89. if (len == 0) {
  90. struct usb_host_endpoint *hep;
  91. hep = intf->cur_altsetting->endpoint;
  92. if (hep) {
  93. buf = hep->extra;
  94. len = hep->extralen;
  95. }
  96. if (len)
  97. dev_dbg(&intf->dev,
  98. "CDC descriptors on endpoint\n");
  99. }
  100. /* this assumes that if there's a non-RNDIS vendor variant
  101. * of cdc-acm, it'll fail RNDIS requests cleanly.
  102. */
  103. rndis = (is_rndis(&intf->cur_altsetting->desc) ||
  104. is_activesync(&intf->cur_altsetting->desc) ||
  105. is_wireless_rndis(&intf->cur_altsetting->desc));
  106. memset(info, 0, sizeof *info);
  107. info->control = intf;
  108. while (len > 3) {
  109. if (buf [1] != USB_DT_CS_INTERFACE)
  110. goto next_desc;
  111. /* use bDescriptorSubType to identify the CDC descriptors.
  112. * We expect devices with CDC header and union descriptors.
  113. * For CDC Ethernet we need the ethernet descriptor.
  114. * For RNDIS, ignore two (pointless) CDC modem descriptors
  115. * in favor of a complicated OID-based RPC scheme doing what
  116. * CDC Ethernet achieves with a simple descriptor.
  117. */
  118. switch (buf [2]) {
  119. case USB_CDC_HEADER_TYPE:
  120. if (info->header) {
  121. dev_dbg(&intf->dev, "extra CDC header\n");
  122. goto bad_desc;
  123. }
  124. info->header = (void *) buf;
  125. if (info->header->bLength != sizeof *info->header) {
  126. dev_dbg(&intf->dev, "CDC header len %u\n",
  127. info->header->bLength);
  128. goto bad_desc;
  129. }
  130. break;
  131. case USB_CDC_ACM_TYPE:
  132. /* paranoia: disambiguate a "real" vendor-specific
  133. * modem interface from an RNDIS non-modem.
  134. */
  135. if (rndis) {
  136. struct usb_cdc_acm_descriptor *acm;
  137. acm = (void *) buf;
  138. if (acm->bmCapabilities) {
  139. dev_dbg(&intf->dev,
  140. "ACM capabilities %02x, "
  141. "not really RNDIS?\n",
  142. acm->bmCapabilities);
  143. goto bad_desc;
  144. }
  145. }
  146. break;
  147. case USB_CDC_UNION_TYPE:
  148. if (info->u) {
  149. dev_dbg(&intf->dev, "extra CDC union\n");
  150. goto bad_desc;
  151. }
  152. info->u = (void *) buf;
  153. if (info->u->bLength != sizeof *info->u) {
  154. dev_dbg(&intf->dev, "CDC union len %u\n",
  155. info->u->bLength);
  156. goto bad_desc;
  157. }
  158. /* we need a master/control interface (what we're
  159. * probed with) and a slave/data interface; union
  160. * descriptors sort this all out.
  161. */
  162. info->control = usb_ifnum_to_if(dev->udev,
  163. info->u->bMasterInterface0);
  164. info->data = usb_ifnum_to_if(dev->udev,
  165. info->u->bSlaveInterface0);
  166. if (!info->control || !info->data) {
  167. dev_dbg(&intf->dev,
  168. "master #%u/%p slave #%u/%p\n",
  169. info->u->bMasterInterface0,
  170. info->control,
  171. info->u->bSlaveInterface0,
  172. info->data);
  173. goto bad_desc;
  174. }
  175. if (info->control != intf) {
  176. dev_dbg(&intf->dev, "bogus CDC Union\n");
  177. /* Ambit USB Cable Modem (and maybe others)
  178. * interchanges master and slave interface.
  179. */
  180. if (info->data == intf) {
  181. info->data = info->control;
  182. info->control = intf;
  183. } else
  184. goto bad_desc;
  185. }
  186. /* a data interface altsetting does the real i/o */
  187. d = &info->data->cur_altsetting->desc;
  188. if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
  189. dev_dbg(&intf->dev, "slave class %u\n",
  190. d->bInterfaceClass);
  191. goto bad_desc;
  192. }
  193. break;
  194. case USB_CDC_ETHERNET_TYPE:
  195. if (info->ether) {
  196. dev_dbg(&intf->dev, "extra CDC ether\n");
  197. goto bad_desc;
  198. }
  199. info->ether = (void *) buf;
  200. if (info->ether->bLength != sizeof *info->ether) {
  201. dev_dbg(&intf->dev, "CDC ether len %u\n",
  202. info->ether->bLength);
  203. goto bad_desc;
  204. }
  205. dev->hard_mtu = le16_to_cpu(
  206. info->ether->wMaxSegmentSize);
  207. /* because of Zaurus, we may be ignoring the host
  208. * side link address we were given.
  209. */
  210. break;
  211. }
  212. next_desc:
  213. len -= buf [0]; /* bLength */
  214. buf += buf [0];
  215. }
  216. /* Microsoft ActiveSync based and some regular RNDIS devices lack the
  217. * CDC descriptors, so we'll hard-wire the interfaces and not check
  218. * for descriptors.
  219. */
  220. if (rndis && !info->u) {
  221. info->control = usb_ifnum_to_if(dev->udev, 0);
  222. info->data = usb_ifnum_to_if(dev->udev, 1);
  223. if (!info->control || !info->data) {
  224. dev_dbg(&intf->dev,
  225. "rndis: master #0/%p slave #1/%p\n",
  226. info->control,
  227. info->data);
  228. goto bad_desc;
  229. }
  230. } else if (!info->header || !info->u || (!rndis && !info->ether)) {
  231. dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
  232. info->header ? "" : "header ",
  233. info->u ? "" : "union ",
  234. info->ether ? "" : "ether ");
  235. goto bad_desc;
  236. }
  237. /* claim data interface and set it up ... with side effects.
  238. * network traffic can't flow until an altsetting is enabled.
  239. */
  240. status = usb_driver_claim_interface(driver, info->data, dev);
  241. if (status < 0)
  242. return status;
  243. status = usbnet_get_endpoints(dev, info->data);
  244. if (status < 0) {
  245. /* ensure immediate exit from usbnet_disconnect */
  246. usb_set_intfdata(info->data, NULL);
  247. usb_driver_release_interface(driver, info->data);
  248. return status;
  249. }
  250. /* status endpoint: optional for CDC Ethernet, not RNDIS (or ACM) */
  251. dev->status = NULL;
  252. if (info->control->cur_altsetting->desc.bNumEndpoints == 1) {
  253. struct usb_endpoint_descriptor *desc;
  254. dev->status = &info->control->cur_altsetting->endpoint [0];
  255. desc = &dev->status->desc;
  256. if (!usb_endpoint_is_int_in(desc) ||
  257. (le16_to_cpu(desc->wMaxPacketSize)
  258. < sizeof(struct usb_cdc_notification)) ||
  259. !desc->bInterval) {
  260. dev_dbg(&intf->dev, "bad notification endpoint\n");
  261. dev->status = NULL;
  262. }
  263. }
  264. if (rndis && !dev->status) {
  265. dev_dbg(&intf->dev, "missing RNDIS status endpoint\n");
  266. usb_set_intfdata(info->data, NULL);
  267. usb_driver_release_interface(driver, info->data);
  268. return -ENODEV;
  269. }
  270. return 0;
  271. bad_desc:
  272. dev_info(&dev->udev->dev, "bad CDC descriptors\n");
  273. return -ENODEV;
  274. }
  275. EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
  276. void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
  277. {
  278. struct cdc_state *info = (void *) &dev->data;
  279. struct usb_driver *driver = driver_of(intf);
  280. /* disconnect master --> disconnect slave */
  281. if (intf == info->control && info->data) {
  282. /* ensure immediate exit from usbnet_disconnect */
  283. usb_set_intfdata(info->data, NULL);
  284. usb_driver_release_interface(driver, info->data);
  285. info->data = NULL;
  286. }
  287. /* and vice versa (just in case) */
  288. else if (intf == info->data && info->control) {
  289. /* ensure immediate exit from usbnet_disconnect */
  290. usb_set_intfdata(info->control, NULL);
  291. usb_driver_release_interface(driver, info->control);
  292. info->control = NULL;
  293. }
  294. }
  295. EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
  296. /*-------------------------------------------------------------------------
  297. *
  298. * Communications Device Class, Ethernet Control model
  299. *
  300. * Takes two interfaces. The DATA interface is inactive till an altsetting
  301. * is selected. Configuration data includes class descriptors. There's
  302. * an optional status endpoint on the control interface.
  303. *
  304. * This should interop with whatever the 2.4 "CDCEther.c" driver
  305. * (by Brad Hards) talked with, with more functionality.
  306. *
  307. *-------------------------------------------------------------------------*/
  308. static void dumpspeed(struct usbnet *dev, __le32 *speeds)
  309. {
  310. netif_info(dev, timer, dev->net,
  311. "link speeds: %u kbps up, %u kbps down\n",
  312. __le32_to_cpu(speeds[0]) / 1000,
  313. __le32_to_cpu(speeds[1]) / 1000);
  314. }
  315. static void cdc_status(struct usbnet *dev, struct urb *urb)
  316. {
  317. struct usb_cdc_notification *event;
  318. if (urb->actual_length < sizeof *event)
  319. return;
  320. /* SPEED_CHANGE can get split into two 8-byte packets */
  321. if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) {
  322. dumpspeed(dev, (__le32 *) urb->transfer_buffer);
  323. return;
  324. }
  325. event = urb->transfer_buffer;
  326. switch (event->bNotificationType) {
  327. case USB_CDC_NOTIFY_NETWORK_CONNECTION:
  328. netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
  329. event->wValue ? "on" : "off");
  330. if (event->wValue)
  331. netif_carrier_on(dev->net);
  332. else
  333. netif_carrier_off(dev->net);
  334. break;
  335. case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
  336. netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
  337. urb->actual_length);
  338. if (urb->actual_length != (sizeof *event + 8))
  339. set_bit(EVENT_STS_SPLIT, &dev->flags);
  340. else
  341. dumpspeed(dev, (__le32 *) &event[1]);
  342. break;
  343. /* USB_CDC_NOTIFY_RESPONSE_AVAILABLE can happen too (e.g. RNDIS),
  344. * but there are no standard formats for the response data.
  345. */
  346. default:
  347. netdev_err(dev->net, "CDC: unexpected notification %02x!\n",
  348. event->bNotificationType);
  349. break;
  350. }
  351. }
  352. static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
  353. {
  354. int status;
  355. struct cdc_state *info = (void *) &dev->data;
  356. status = usbnet_generic_cdc_bind(dev, intf);
  357. if (status < 0)
  358. return status;
  359. status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress);
  360. if (status < 0) {
  361. usb_set_intfdata(info->data, NULL);
  362. usb_driver_release_interface(driver_of(intf), info->data);
  363. return status;
  364. }
  365. /* FIXME cdc-ether has some multicast code too, though it complains
  366. * in routine cases. info->ether describes the multicast support.
  367. * Implement that here, manipulating the cdc filter as needed.
  368. */
  369. return 0;
  370. }
  371. static int cdc_manage_power(struct usbnet *dev, int on)
  372. {
  373. dev->intf->needs_remote_wakeup = on;
  374. return 0;
  375. }
  376. static const struct driver_info cdc_info = {
  377. .description = "CDC Ethernet Device",
  378. .flags = FLAG_ETHER,
  379. // .check_connect = cdc_check_connect,
  380. .bind = cdc_bind,
  381. .unbind = usbnet_cdc_unbind,
  382. .status = cdc_status,
  383. .manage_power = cdc_manage_power,
  384. };
  385. static const struct driver_info mbm_info = {
  386. .description = "Mobile Broadband Network Device",
  387. .flags = FLAG_WWAN,
  388. .bind = cdc_bind,
  389. .unbind = usbnet_cdc_unbind,
  390. .status = cdc_status,
  391. };
  392. /*-------------------------------------------------------------------------*/
  393. static const struct usb_device_id products [] = {
  394. /*
  395. * BLACKLIST !!
  396. *
  397. * First blacklist any products that are egregiously nonconformant
  398. * with the CDC Ethernet specs. Minor braindamage we cope with; when
  399. * they're not even trying, needing a separate driver is only the first
  400. * of the differences to show up.
  401. */
  402. #define ZAURUS_MASTER_INTERFACE \
  403. .bInterfaceClass = USB_CLASS_COMM, \
  404. .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
  405. .bInterfaceProtocol = USB_CDC_PROTO_NONE
  406. /* SA-1100 based Sharp Zaurus ("collie"), or compatible;
  407. * wire-incompatible with true CDC Ethernet implementations.
  408. * (And, it seems, needlessly so...)
  409. */
  410. {
  411. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  412. | USB_DEVICE_ID_MATCH_DEVICE,
  413. .idVendor = 0x04DD,
  414. .idProduct = 0x8004,
  415. ZAURUS_MASTER_INTERFACE,
  416. .driver_info = 0,
  417. },
  418. /* PXA-25x based Sharp Zaurii. Note that it seems some of these
  419. * (later models especially) may have shipped only with firmware
  420. * advertising false "CDC MDLM" compatibility ... but we're not
  421. * clear which models did that, so for now let's assume the worst.
  422. */
  423. {
  424. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  425. | USB_DEVICE_ID_MATCH_DEVICE,
  426. .idVendor = 0x04DD,
  427. .idProduct = 0x8005, /* A-300 */
  428. ZAURUS_MASTER_INTERFACE,
  429. .driver_info = 0,
  430. }, {
  431. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  432. | USB_DEVICE_ID_MATCH_DEVICE,
  433. .idVendor = 0x04DD,
  434. .idProduct = 0x8006, /* B-500/SL-5600 */
  435. ZAURUS_MASTER_INTERFACE,
  436. .driver_info = 0,
  437. }, {
  438. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  439. | USB_DEVICE_ID_MATCH_DEVICE,
  440. .idVendor = 0x04DD,
  441. .idProduct = 0x8007, /* C-700 */
  442. ZAURUS_MASTER_INTERFACE,
  443. .driver_info = 0,
  444. }, {
  445. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  446. | USB_DEVICE_ID_MATCH_DEVICE,
  447. .idVendor = 0x04DD,
  448. .idProduct = 0x9031, /* C-750 C-760 */
  449. ZAURUS_MASTER_INTERFACE,
  450. .driver_info = 0,
  451. }, {
  452. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  453. | USB_DEVICE_ID_MATCH_DEVICE,
  454. .idVendor = 0x04DD,
  455. .idProduct = 0x9032, /* SL-6000 */
  456. ZAURUS_MASTER_INTERFACE,
  457. .driver_info = 0,
  458. }, {
  459. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  460. | USB_DEVICE_ID_MATCH_DEVICE,
  461. .idVendor = 0x04DD,
  462. /* reported with some C860 units */
  463. .idProduct = 0x9050, /* C-860 */
  464. ZAURUS_MASTER_INTERFACE,
  465. .driver_info = 0,
  466. },
  467. /* Olympus has some models with a Zaurus-compatible option.
  468. * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
  469. */
  470. {
  471. .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
  472. | USB_DEVICE_ID_MATCH_DEVICE,
  473. .idVendor = 0x07B4,
  474. .idProduct = 0x0F02, /* R-1000 */
  475. ZAURUS_MASTER_INTERFACE,
  476. .driver_info = 0,
  477. },
  478. /*
  479. * WHITELIST!!!
  480. *
  481. * CDC Ether uses two interfaces, not necessarily consecutive.
  482. * We match the main interface, ignoring the optional device
  483. * class so we could handle devices that aren't exclusively
  484. * CDC ether.
  485. *
  486. * NOTE: this match must come AFTER entries blacklisting devices
  487. * because of bugs/quirks in a given product (like Zaurus, above).
  488. */
  489. {
  490. USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
  491. USB_CDC_PROTO_NONE),
  492. .driver_info = (unsigned long) &cdc_info,
  493. }, {
  494. /* Ericsson F3507g */
  495. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
  496. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  497. .driver_info = (unsigned long) &mbm_info,
  498. }, {
  499. /* Ericsson F3507g ver. 2 */
  500. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
  501. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  502. .driver_info = (unsigned long) &mbm_info,
  503. }, {
  504. /* Ericsson F3607gw */
  505. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
  506. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  507. .driver_info = (unsigned long) &mbm_info,
  508. }, {
  509. /* Ericsson F3607gw ver 2 */
  510. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM,
  511. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  512. .driver_info = (unsigned long) &mbm_info,
  513. }, {
  514. /* Ericsson F3607gw ver 3 */
  515. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
  516. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  517. .driver_info = (unsigned long) &mbm_info,
  518. }, {
  519. /* Ericsson F3307 */
  520. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM,
  521. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  522. .driver_info = (unsigned long) &mbm_info,
  523. }, {
  524. /* Ericsson F3307 ver 2 */
  525. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM,
  526. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  527. .driver_info = (unsigned long) &mbm_info,
  528. }, {
  529. /* Ericsson C3607w */
  530. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
  531. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  532. .driver_info = (unsigned long) &mbm_info,
  533. }, {
  534. /* Ericsson C3607w ver 2 */
  535. USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
  536. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  537. .driver_info = (unsigned long) &mbm_info,
  538. }, {
  539. /* Toshiba F3507g */
  540. USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
  541. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  542. .driver_info = (unsigned long) &mbm_info,
  543. }, {
  544. /* Toshiba F3607gw */
  545. USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM,
  546. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  547. .driver_info = (unsigned long) &mbm_info,
  548. }, {
  549. /* Toshiba F3607gw ver 2 */
  550. USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM,
  551. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  552. .driver_info = (unsigned long) &mbm_info,
  553. }, {
  554. /* Dell F3507g */
  555. USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
  556. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  557. .driver_info = (unsigned long) &mbm_info,
  558. }, {
  559. /* Dell F3607gw */
  560. USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM,
  561. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  562. .driver_info = (unsigned long) &mbm_info,
  563. }, {
  564. /* Dell F3607gw ver 2 */
  565. USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM,
  566. USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
  567. .driver_info = (unsigned long) &mbm_info,
  568. },
  569. { }, // END
  570. };
  571. MODULE_DEVICE_TABLE(usb, products);
  572. static struct usb_driver cdc_driver = {
  573. .name = "cdc_ether",
  574. .id_table = products,
  575. .probe = usbnet_probe,
  576. .disconnect = usbnet_disconnect,
  577. .suspend = usbnet_suspend,
  578. .resume = usbnet_resume,
  579. .reset_resume = usbnet_resume,
  580. .supports_autosuspend = 1,
  581. };
  582. static int __init cdc_init(void)
  583. {
  584. BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
  585. < sizeof(struct cdc_state)));
  586. return usb_register(&cdc_driver);
  587. }
  588. module_init(cdc_init);
  589. static void __exit cdc_exit(void)
  590. {
  591. usb_deregister(&cdc_driver);
  592. }
  593. module_exit(cdc_exit);
  594. MODULE_AUTHOR("David Brownell");
  595. MODULE_DESCRIPTION("USB CDC Ethernet devices");
  596. MODULE_LICENSE("GPL");