f_eem.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * f_eem.c -- USB CDC Ethernet (EEM) link function driver
  4. *
  5. * Copyright (C) 2003-2005,2008 David Brownell
  6. * Copyright (C) 2008 Nokia Corporation
  7. * Copyright (C) 2009 EF Johnson Technologies
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/module.h>
  11. #include <linux/device.h>
  12. #include <linux/etherdevice.h>
  13. #include <linux/crc32.h>
  14. #include <linux/slab.h>
  15. #include "u_ether.h"
  16. #include "u_ether_configfs.h"
  17. #include "u_eem.h"
  18. #define EEM_HLEN 2
  19. /*
  20. * This function is a "CDC Ethernet Emulation Model" (CDC EEM)
  21. * Ethernet link.
  22. */
  23. struct f_eem {
  24. struct gether port;
  25. u8 ctrl_id;
  26. };
  27. static inline struct f_eem *func_to_eem(struct usb_function *f)
  28. {
  29. return container_of(f, struct f_eem, port.func);
  30. }
  31. /*-------------------------------------------------------------------------*/
  32. /* interface descriptor: */
  33. static struct usb_interface_descriptor eem_intf = {
  34. .bLength = sizeof eem_intf,
  35. .bDescriptorType = USB_DT_INTERFACE,
  36. /* .bInterfaceNumber = DYNAMIC */
  37. .bNumEndpoints = 2,
  38. .bInterfaceClass = USB_CLASS_COMM,
  39. .bInterfaceSubClass = USB_CDC_SUBCLASS_EEM,
  40. .bInterfaceProtocol = USB_CDC_PROTO_EEM,
  41. /* .iInterface = DYNAMIC */
  42. };
  43. /* full speed support: */
  44. static struct usb_endpoint_descriptor eem_fs_in_desc = {
  45. .bLength = USB_DT_ENDPOINT_SIZE,
  46. .bDescriptorType = USB_DT_ENDPOINT,
  47. .bEndpointAddress = USB_DIR_IN,
  48. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  49. };
  50. static struct usb_endpoint_descriptor eem_fs_out_desc = {
  51. .bLength = USB_DT_ENDPOINT_SIZE,
  52. .bDescriptorType = USB_DT_ENDPOINT,
  53. .bEndpointAddress = USB_DIR_OUT,
  54. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  55. };
  56. static struct usb_descriptor_header *eem_fs_function[] = {
  57. /* CDC EEM control descriptors */
  58. (struct usb_descriptor_header *) &eem_intf,
  59. (struct usb_descriptor_header *) &eem_fs_in_desc,
  60. (struct usb_descriptor_header *) &eem_fs_out_desc,
  61. NULL,
  62. };
  63. /* high speed support: */
  64. static struct usb_endpoint_descriptor eem_hs_in_desc = {
  65. .bLength = USB_DT_ENDPOINT_SIZE,
  66. .bDescriptorType = USB_DT_ENDPOINT,
  67. .bEndpointAddress = USB_DIR_IN,
  68. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  69. .wMaxPacketSize = cpu_to_le16(512),
  70. };
  71. static struct usb_endpoint_descriptor eem_hs_out_desc = {
  72. .bLength = USB_DT_ENDPOINT_SIZE,
  73. .bDescriptorType = USB_DT_ENDPOINT,
  74. .bEndpointAddress = USB_DIR_OUT,
  75. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  76. .wMaxPacketSize = cpu_to_le16(512),
  77. };
  78. static struct usb_descriptor_header *eem_hs_function[] = {
  79. /* CDC EEM control descriptors */
  80. (struct usb_descriptor_header *) &eem_intf,
  81. (struct usb_descriptor_header *) &eem_hs_in_desc,
  82. (struct usb_descriptor_header *) &eem_hs_out_desc,
  83. NULL,
  84. };
  85. /* super speed support: */
  86. static struct usb_endpoint_descriptor eem_ss_in_desc = {
  87. .bLength = USB_DT_ENDPOINT_SIZE,
  88. .bDescriptorType = USB_DT_ENDPOINT,
  89. .bEndpointAddress = USB_DIR_IN,
  90. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  91. .wMaxPacketSize = cpu_to_le16(1024),
  92. };
  93. static struct usb_endpoint_descriptor eem_ss_out_desc = {
  94. .bLength = USB_DT_ENDPOINT_SIZE,
  95. .bDescriptorType = USB_DT_ENDPOINT,
  96. .bEndpointAddress = USB_DIR_OUT,
  97. .bmAttributes = USB_ENDPOINT_XFER_BULK,
  98. .wMaxPacketSize = cpu_to_le16(1024),
  99. };
  100. static struct usb_ss_ep_comp_descriptor eem_ss_bulk_comp_desc = {
  101. .bLength = sizeof eem_ss_bulk_comp_desc,
  102. .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
  103. /* the following 2 values can be tweaked if necessary */
  104. /* .bMaxBurst = 0, */
  105. /* .bmAttributes = 0, */
  106. };
  107. static struct usb_descriptor_header *eem_ss_function[] = {
  108. /* CDC EEM control descriptors */
  109. (struct usb_descriptor_header *) &eem_intf,
  110. (struct usb_descriptor_header *) &eem_ss_in_desc,
  111. (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
  112. (struct usb_descriptor_header *) &eem_ss_out_desc,
  113. (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
  114. NULL,
  115. };
  116. /* string descriptors: */
  117. static struct usb_string eem_string_defs[] = {
  118. [0].s = "CDC Ethernet Emulation Model (EEM)",
  119. { } /* end of list */
  120. };
  121. static struct usb_gadget_strings eem_string_table = {
  122. .language = 0x0409, /* en-us */
  123. .strings = eem_string_defs,
  124. };
  125. static struct usb_gadget_strings *eem_strings[] = {
  126. &eem_string_table,
  127. NULL,
  128. };
  129. /*-------------------------------------------------------------------------*/
  130. static int eem_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
  131. {
  132. struct usb_composite_dev *cdev = f->config->cdev;
  133. int value = -EOPNOTSUPP;
  134. u16 w_index = le16_to_cpu(ctrl->wIndex);
  135. u16 w_value = le16_to_cpu(ctrl->wValue);
  136. u16 w_length = le16_to_cpu(ctrl->wLength);
  137. DBG(cdev, "invalid control req%02x.%02x v%04x i%04x l%d\n",
  138. ctrl->bRequestType, ctrl->bRequest,
  139. w_value, w_index, w_length);
  140. /* device either stalls (value < 0) or reports success */
  141. return value;
  142. }
  143. static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
  144. {
  145. struct f_eem *eem = func_to_eem(f);
  146. struct usb_composite_dev *cdev = f->config->cdev;
  147. struct net_device *net;
  148. /* we know alt == 0, so this is an activation or a reset */
  149. if (alt != 0)
  150. goto fail;
  151. if (intf == eem->ctrl_id) {
  152. DBG(cdev, "reset eem\n");
  153. gether_disconnect(&eem->port);
  154. if (!eem->port.in_ep->desc || !eem->port.out_ep->desc) {
  155. DBG(cdev, "init eem\n");
  156. if (config_ep_by_speed(cdev->gadget, f,
  157. eem->port.in_ep) ||
  158. config_ep_by_speed(cdev->gadget, f,
  159. eem->port.out_ep)) {
  160. eem->port.in_ep->desc = NULL;
  161. eem->port.out_ep->desc = NULL;
  162. goto fail;
  163. }
  164. }
  165. /* zlps should not occur because zero-length EEM packets
  166. * will be inserted in those cases where they would occur
  167. */
  168. eem->port.is_zlp_ok = 1;
  169. eem->port.cdc_filter = DEFAULT_FILTER;
  170. DBG(cdev, "activate eem\n");
  171. net = gether_connect(&eem->port);
  172. if (IS_ERR(net))
  173. return PTR_ERR(net);
  174. } else
  175. goto fail;
  176. return 0;
  177. fail:
  178. return -EINVAL;
  179. }
  180. static void eem_disable(struct usb_function *f)
  181. {
  182. struct f_eem *eem = func_to_eem(f);
  183. struct usb_composite_dev *cdev = f->config->cdev;
  184. DBG(cdev, "eem deactivated\n");
  185. if (eem->port.in_ep->enabled)
  186. gether_disconnect(&eem->port);
  187. }
  188. /*-------------------------------------------------------------------------*/
  189. /* EEM function driver setup/binding */
  190. static int eem_bind(struct usb_configuration *c, struct usb_function *f)
  191. {
  192. struct usb_composite_dev *cdev = c->cdev;
  193. struct f_eem *eem = func_to_eem(f);
  194. struct usb_string *us;
  195. int status;
  196. struct usb_ep *ep;
  197. struct f_eem_opts *eem_opts;
  198. eem_opts = container_of(f->fi, struct f_eem_opts, func_inst);
  199. /*
  200. * in drivers/usb/gadget/configfs.c:configfs_composite_bind()
  201. * configurations are bound in sequence with list_for_each_entry,
  202. * in each configuration its functions are bound in sequence
  203. * with list_for_each_entry, so we assume no race condition
  204. * with regard to eem_opts->bound access
  205. */
  206. if (!eem_opts->bound) {
  207. mutex_lock(&eem_opts->lock);
  208. gether_set_gadget(eem_opts->net, cdev->gadget);
  209. status = gether_register_netdev(eem_opts->net);
  210. mutex_unlock(&eem_opts->lock);
  211. if (status)
  212. return status;
  213. eem_opts->bound = true;
  214. }
  215. us = usb_gstrings_attach(cdev, eem_strings,
  216. ARRAY_SIZE(eem_string_defs));
  217. if (IS_ERR(us))
  218. return PTR_ERR(us);
  219. eem_intf.iInterface = us[0].id;
  220. /* allocate instance-specific interface IDs */
  221. status = usb_interface_id(c, f);
  222. if (status < 0)
  223. goto fail;
  224. eem->ctrl_id = status;
  225. eem_intf.bInterfaceNumber = status;
  226. status = -ENODEV;
  227. /* allocate instance-specific endpoints */
  228. ep = usb_ep_autoconfig(cdev->gadget, &eem_fs_in_desc);
  229. if (!ep)
  230. goto fail;
  231. eem->port.in_ep = ep;
  232. ep = usb_ep_autoconfig(cdev->gadget, &eem_fs_out_desc);
  233. if (!ep)
  234. goto fail;
  235. eem->port.out_ep = ep;
  236. status = -ENOMEM;
  237. /* support all relevant hardware speeds... we expect that when
  238. * hardware is dual speed, all bulk-capable endpoints work at
  239. * both speeds
  240. */
  241. eem_hs_in_desc.bEndpointAddress = eem_fs_in_desc.bEndpointAddress;
  242. eem_hs_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress;
  243. eem_ss_in_desc.bEndpointAddress = eem_fs_in_desc.bEndpointAddress;
  244. eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress;
  245. status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function,
  246. eem_ss_function, NULL);
  247. if (status)
  248. goto fail;
  249. DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n",
  250. gadget_is_superspeed(c->cdev->gadget) ? "super" :
  251. gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
  252. eem->port.in_ep->name, eem->port.out_ep->name);
  253. return 0;
  254. fail:
  255. ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
  256. return status;
  257. }
  258. static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req)
  259. {
  260. struct sk_buff *skb = (struct sk_buff *)req->context;
  261. dev_kfree_skb_any(skb);
  262. }
  263. /*
  264. * Add the EEM header and ethernet checksum.
  265. * We currently do not attempt to put multiple ethernet frames
  266. * into a single USB transfer
  267. */
  268. static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb)
  269. {
  270. struct sk_buff *skb2 = NULL;
  271. struct usb_ep *in = port->in_ep;
  272. int headroom, tailroom, padlen = 0;
  273. u16 len;
  274. if (!skb)
  275. return NULL;
  276. len = skb->len;
  277. headroom = skb_headroom(skb);
  278. tailroom = skb_tailroom(skb);
  279. /* When (len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) is 0,
  280. * stick two bytes of zero-length EEM packet on the end.
  281. */
  282. if (((len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) == 0)
  283. padlen += 2;
  284. if ((tailroom >= (ETH_FCS_LEN + padlen)) &&
  285. (headroom >= EEM_HLEN) && !skb_cloned(skb))
  286. goto done;
  287. skb2 = skb_copy_expand(skb, EEM_HLEN, ETH_FCS_LEN + padlen, GFP_ATOMIC);
  288. dev_kfree_skb_any(skb);
  289. skb = skb2;
  290. if (!skb)
  291. return skb;
  292. done:
  293. /* use the "no CRC" option */
  294. put_unaligned_be32(0xdeadbeef, skb_put(skb, 4));
  295. /* EEM packet header format:
  296. * b0..13: length of ethernet frame
  297. * b14: bmCRC (0 == sentinel CRC)
  298. * b15: bmType (0 == data)
  299. */
  300. len = skb->len;
  301. put_unaligned_le16(len & 0x3FFF, skb_push(skb, 2));
  302. /* add a zero-length EEM packet, if needed */
  303. if (padlen)
  304. put_unaligned_le16(0, skb_put(skb, 2));
  305. return skb;
  306. }
  307. /*
  308. * Remove the EEM header. Note that there can be many EEM packets in a single
  309. * USB transfer, so we need to break them out and handle them independently.
  310. */
  311. static int eem_unwrap(struct gether *port,
  312. struct sk_buff *skb,
  313. struct sk_buff_head *list)
  314. {
  315. struct usb_composite_dev *cdev = port->func.config->cdev;
  316. int status = 0;
  317. do {
  318. struct sk_buff *skb2;
  319. u16 header;
  320. u16 len = 0;
  321. if (skb->len < EEM_HLEN) {
  322. status = -EINVAL;
  323. DBG(cdev, "invalid EEM header\n");
  324. goto error;
  325. }
  326. /* remove the EEM header */
  327. header = get_unaligned_le16(skb->data);
  328. skb_pull(skb, EEM_HLEN);
  329. /* EEM packet header format:
  330. * b0..14: EEM type dependent (data or command)
  331. * b15: bmType (0 == data, 1 == command)
  332. */
  333. if (header & BIT(15)) {
  334. struct usb_request *req = cdev->req;
  335. u16 bmEEMCmd;
  336. /* EEM command packet format:
  337. * b0..10: bmEEMCmdParam
  338. * b11..13: bmEEMCmd
  339. * b14: reserved (must be zero)
  340. * b15: bmType (1 == command)
  341. */
  342. if (header & BIT(14))
  343. continue;
  344. bmEEMCmd = (header >> 11) & 0x7;
  345. switch (bmEEMCmd) {
  346. case 0: /* echo */
  347. len = header & 0x7FF;
  348. if (skb->len < len) {
  349. status = -EOVERFLOW;
  350. goto error;
  351. }
  352. skb2 = skb_clone(skb, GFP_ATOMIC);
  353. if (unlikely(!skb2)) {
  354. DBG(cdev, "EEM echo response error\n");
  355. goto next;
  356. }
  357. skb_trim(skb2, len);
  358. put_unaligned_le16(BIT(15) | BIT(11) | len,
  359. skb_push(skb2, 2));
  360. skb_copy_bits(skb2, 0, req->buf, skb2->len);
  361. req->length = skb2->len;
  362. req->complete = eem_cmd_complete;
  363. req->zero = 1;
  364. req->context = skb2;
  365. if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC))
  366. DBG(cdev, "echo response queue fail\n");
  367. break;
  368. case 1: /* echo response */
  369. case 2: /* suspend hint */
  370. case 3: /* response hint */
  371. case 4: /* response complete hint */
  372. case 5: /* tickle */
  373. default: /* reserved */
  374. continue;
  375. }
  376. } else {
  377. u32 crc, crc2;
  378. struct sk_buff *skb3;
  379. /* check for zero-length EEM packet */
  380. if (header == 0)
  381. continue;
  382. /* EEM data packet format:
  383. * b0..13: length of ethernet frame
  384. * b14: bmCRC (0 == sentinel, 1 == calculated)
  385. * b15: bmType (0 == data)
  386. */
  387. len = header & 0x3FFF;
  388. if ((skb->len < len)
  389. || (len < (ETH_HLEN + ETH_FCS_LEN))) {
  390. status = -EINVAL;
  391. goto error;
  392. }
  393. /* validate CRC */
  394. if (header & BIT(14)) {
  395. crc = get_unaligned_le32(skb->data + len
  396. - ETH_FCS_LEN);
  397. crc2 = ~crc32_le(~0,
  398. skb->data, len - ETH_FCS_LEN);
  399. } else {
  400. crc = get_unaligned_be32(skb->data + len
  401. - ETH_FCS_LEN);
  402. crc2 = 0xdeadbeef;
  403. }
  404. if (crc != crc2) {
  405. DBG(cdev, "invalid EEM CRC\n");
  406. goto next;
  407. }
  408. skb2 = skb_clone(skb, GFP_ATOMIC);
  409. if (unlikely(!skb2)) {
  410. DBG(cdev, "unable to unframe EEM packet\n");
  411. continue;
  412. }
  413. skb_trim(skb2, len - ETH_FCS_LEN);
  414. skb3 = skb_copy_expand(skb2,
  415. NET_IP_ALIGN,
  416. 0,
  417. GFP_ATOMIC);
  418. if (unlikely(!skb3)) {
  419. dev_kfree_skb_any(skb2);
  420. continue;
  421. }
  422. dev_kfree_skb_any(skb2);
  423. skb_queue_tail(list, skb3);
  424. }
  425. next:
  426. skb_pull(skb, len);
  427. } while (skb->len);
  428. error:
  429. dev_kfree_skb_any(skb);
  430. return status;
  431. }
  432. static inline struct f_eem_opts *to_f_eem_opts(struct config_item *item)
  433. {
  434. return container_of(to_config_group(item), struct f_eem_opts,
  435. func_inst.group);
  436. }
  437. /* f_eem_item_ops */
  438. USB_ETHERNET_CONFIGFS_ITEM(eem);
  439. /* f_eem_opts_dev_addr */
  440. USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(eem);
  441. /* f_eem_opts_host_addr */
  442. USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(eem);
  443. /* f_eem_opts_qmult */
  444. USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(eem);
  445. /* f_eem_opts_ifname */
  446. USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(eem);
  447. static struct configfs_attribute *eem_attrs[] = {
  448. &eem_opts_attr_dev_addr,
  449. &eem_opts_attr_host_addr,
  450. &eem_opts_attr_qmult,
  451. &eem_opts_attr_ifname,
  452. NULL,
  453. };
  454. static const struct config_item_type eem_func_type = {
  455. .ct_item_ops = &eem_item_ops,
  456. .ct_attrs = eem_attrs,
  457. .ct_owner = THIS_MODULE,
  458. };
  459. static void eem_free_inst(struct usb_function_instance *f)
  460. {
  461. struct f_eem_opts *opts;
  462. opts = container_of(f, struct f_eem_opts, func_inst);
  463. if (opts->bound)
  464. gether_cleanup(netdev_priv(opts->net));
  465. else
  466. free_netdev(opts->net);
  467. kfree(opts);
  468. }
  469. static struct usb_function_instance *eem_alloc_inst(void)
  470. {
  471. struct f_eem_opts *opts;
  472. opts = kzalloc(sizeof(*opts), GFP_KERNEL);
  473. if (!opts)
  474. return ERR_PTR(-ENOMEM);
  475. mutex_init(&opts->lock);
  476. opts->func_inst.free_func_inst = eem_free_inst;
  477. opts->net = gether_setup_default();
  478. if (IS_ERR(opts->net)) {
  479. struct net_device *net = opts->net;
  480. kfree(opts);
  481. return ERR_CAST(net);
  482. }
  483. config_group_init_type_name(&opts->func_inst.group, "", &eem_func_type);
  484. return &opts->func_inst;
  485. }
  486. static void eem_free(struct usb_function *f)
  487. {
  488. struct f_eem *eem;
  489. struct f_eem_opts *opts;
  490. eem = func_to_eem(f);
  491. opts = container_of(f->fi, struct f_eem_opts, func_inst);
  492. kfree(eem);
  493. mutex_lock(&opts->lock);
  494. opts->refcnt--;
  495. mutex_unlock(&opts->lock);
  496. }
  497. static void eem_unbind(struct usb_configuration *c, struct usb_function *f)
  498. {
  499. DBG(c->cdev, "eem unbind\n");
  500. usb_free_all_descriptors(f);
  501. }
  502. static struct usb_function *eem_alloc(struct usb_function_instance *fi)
  503. {
  504. struct f_eem *eem;
  505. struct f_eem_opts *opts;
  506. /* allocate and initialize one new instance */
  507. eem = kzalloc(sizeof(*eem), GFP_KERNEL);
  508. if (!eem)
  509. return ERR_PTR(-ENOMEM);
  510. opts = container_of(fi, struct f_eem_opts, func_inst);
  511. mutex_lock(&opts->lock);
  512. opts->refcnt++;
  513. eem->port.ioport = netdev_priv(opts->net);
  514. mutex_unlock(&opts->lock);
  515. eem->port.cdc_filter = DEFAULT_FILTER;
  516. eem->port.func.name = "cdc_eem";
  517. /* descriptors are per-instance copies */
  518. eem->port.func.bind = eem_bind;
  519. eem->port.func.unbind = eem_unbind;
  520. eem->port.func.set_alt = eem_set_alt;
  521. eem->port.func.setup = eem_setup;
  522. eem->port.func.disable = eem_disable;
  523. eem->port.func.free_func = eem_free;
  524. eem->port.wrap = eem_wrap;
  525. eem->port.unwrap = eem_unwrap;
  526. eem->port.header_len = EEM_HLEN;
  527. return &eem->port.func;
  528. }
  529. DECLARE_USB_FUNCTION_INIT(eem, eem_alloc_inst, eem_alloc);
  530. MODULE_LICENSE("GPL");
  531. MODULE_AUTHOR("David Brownell");