kingsun-sir.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*****************************************************************************
  2. *
  3. * Filename: kingsun-sir.c
  4. * Version: 0.1.1
  5. * Description: Irda KingSun/DonShine USB Dongle
  6. * Status: Experimental
  7. * Author: Alex Villacís Lasso <a_villacis@palosanto.com>
  8. *
  9. * Based on stir4200 and mcs7780 drivers, with (strange?) differences
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. *****************************************************************************/
  25. /*
  26. * This is my current (2007-04-25) understanding of how this dongle is supposed
  27. * to work. This is based on reverse-engineering and examination of the packet
  28. * data sent and received by the WinXP driver using USBSnoopy. Feel free to
  29. * update here as more of this dongle is known:
  30. *
  31. * General: Unlike the other USB IrDA dongles, this particular dongle exposes,
  32. * not two bulk (in and out) endpoints, but two *interrupt* ones. This dongle,
  33. * like the bulk based ones (stir4200.c and mcs7780.c), requires polling in
  34. * order to receive data.
  35. * Transmission: Just like stir4200, this dongle uses a raw stream of data,
  36. * which needs to be wrapped and escaped in a similar way as in stir4200.c.
  37. * Reception: Poll-based, as in stir4200. Each read returns the contents of a
  38. * 8-byte buffer, of which the first byte (LSB) indicates the number of bytes
  39. * (1-7) of valid data contained within the remaining 7 bytes. For example, if
  40. * the buffer had the following contents:
  41. * 06 ff ff ff c0 01 04 aa
  42. * This means that (06) there are 6 bytes of valid data. The byte 0xaa at the
  43. * end is garbage (left over from a previous reception) and is discarded.
  44. * If a read returns an "impossible" value as the length of valid data (such as
  45. * 0x36) in the first byte, then the buffer is uninitialized (as is the case of
  46. * first plug-in) and its contents should be discarded. There is currently no
  47. * evidence that the top 5 bits of the 1st byte of the buffer can have values
  48. * other than 0 once reception begins.
  49. * Once valid bytes are collected, the assembled stream is a sequence of
  50. * wrapped IrDA frames that is unwrapped and unescaped as in stir4200.c.
  51. * BIG FAT WARNING: the dongle does *not* reset the RX buffer in any way after
  52. * a successful read from the host, which means that in absence of further
  53. * reception, repeated reads from the dongle will return the exact same
  54. * contents repeatedly. Attempts to be smart and cache a previous read seem
  55. * to result in corrupted packets, so this driver depends on the unwrap logic
  56. * to sort out any repeated reads.
  57. * Speed change: no commands observed so far to change speed, assumed fixed
  58. * 9600bps (SIR).
  59. */
  60. #include <linux/module.h>
  61. #include <linux/moduleparam.h>
  62. #include <linux/kernel.h>
  63. #include <linux/types.h>
  64. #include <linux/errno.h>
  65. #include <linux/init.h>
  66. #include <linux/slab.h>
  67. #include <linux/usb.h>
  68. #include <linux/device.h>
  69. #include <linux/crc32.h>
  70. #include <asm/unaligned.h>
  71. #include <asm/byteorder.h>
  72. #include <asm/uaccess.h>
  73. #include <net/irda/irda.h>
  74. #include <net/irda/wrapper.h>
  75. #include <net/irda/crc.h>
  76. /*
  77. * According to lsusb, 0x07c0 is assigned to
  78. * "Code Mercenaries Hard- und Software GmbH"
  79. */
  80. #define KING_VENDOR_ID 0x07c0
  81. #define KING_PRODUCT_ID 0x4200
  82. /* These are the currently known USB ids */
  83. static struct usb_device_id dongles[] = {
  84. /* KingSun Co,Ltd IrDA/USB Bridge */
  85. { USB_DEVICE(KING_VENDOR_ID, KING_PRODUCT_ID) },
  86. { }
  87. };
  88. MODULE_DEVICE_TABLE(usb, dongles);
  89. #define KINGSUN_MTT 0x07
  90. #define KINGSUN_FIFO_SIZE 4096
  91. #define KINGSUN_EP_IN 0
  92. #define KINGSUN_EP_OUT 1
  93. struct kingsun_cb {
  94. struct usb_device *usbdev; /* init: probe_irda */
  95. struct net_device *netdev; /* network layer */
  96. struct irlap_cb *irlap; /* The link layer we are binded to */
  97. struct qos_info qos;
  98. __u8 *in_buf; /* receive buffer */
  99. __u8 *out_buf; /* transmit buffer */
  100. __u8 max_rx; /* max. atomic read from dongle
  101. (usually 8), also size of in_buf */
  102. __u8 max_tx; /* max. atomic write to dongle
  103. (usually 8) */
  104. iobuff_t rx_buff; /* receive unwrap state machine */
  105. struct timeval rx_time;
  106. spinlock_t lock;
  107. int receiving;
  108. __u8 ep_in;
  109. __u8 ep_out;
  110. struct urb *tx_urb;
  111. struct urb *rx_urb;
  112. };
  113. /* Callback transmission routine */
  114. static void kingsun_send_irq(struct urb *urb)
  115. {
  116. struct kingsun_cb *kingsun = urb->context;
  117. struct net_device *netdev = kingsun->netdev;
  118. /* in process of stopping, just drop data */
  119. if (!netif_running(kingsun->netdev)) {
  120. err("kingsun_send_irq: Network not running!");
  121. return;
  122. }
  123. /* unlink, shutdown, unplug, other nasties */
  124. if (urb->status != 0) {
  125. err("kingsun_send_irq: urb asynchronously failed - %d",
  126. urb->status);
  127. }
  128. netif_wake_queue(netdev);
  129. }
  130. /*
  131. * Called from net/core when new frame is available.
  132. */
  133. static netdev_tx_t kingsun_hard_xmit(struct sk_buff *skb,
  134. struct net_device *netdev)
  135. {
  136. struct kingsun_cb *kingsun;
  137. int wraplen;
  138. int ret = 0;
  139. netif_stop_queue(netdev);
  140. /* the IRDA wrapping routines don't deal with non linear skb */
  141. SKB_LINEAR_ASSERT(skb);
  142. kingsun = netdev_priv(netdev);
  143. spin_lock(&kingsun->lock);
  144. /* Append data to the end of whatever data remains to be transmitted */
  145. wraplen = async_wrap_skb(skb,
  146. kingsun->out_buf,
  147. KINGSUN_FIFO_SIZE);
  148. /* Calculate how much data can be transmitted in this urb */
  149. usb_fill_int_urb(kingsun->tx_urb, kingsun->usbdev,
  150. usb_sndintpipe(kingsun->usbdev, kingsun->ep_out),
  151. kingsun->out_buf, wraplen, kingsun_send_irq,
  152. kingsun, 1);
  153. if ((ret = usb_submit_urb(kingsun->tx_urb, GFP_ATOMIC))) {
  154. err("kingsun_hard_xmit: failed tx_urb submit: %d", ret);
  155. switch (ret) {
  156. case -ENODEV:
  157. case -EPIPE:
  158. break;
  159. default:
  160. netdev->stats.tx_errors++;
  161. netif_start_queue(netdev);
  162. }
  163. } else {
  164. netdev->stats.tx_packets++;
  165. netdev->stats.tx_bytes += skb->len;
  166. }
  167. dev_kfree_skb(skb);
  168. spin_unlock(&kingsun->lock);
  169. return NETDEV_TX_OK;
  170. }
  171. /* Receive callback function */
  172. static void kingsun_rcv_irq(struct urb *urb)
  173. {
  174. struct kingsun_cb *kingsun = urb->context;
  175. int ret;
  176. /* in process of stopping, just drop data */
  177. if (!netif_running(kingsun->netdev)) {
  178. kingsun->receiving = 0;
  179. return;
  180. }
  181. /* unlink, shutdown, unplug, other nasties */
  182. if (urb->status != 0) {
  183. err("kingsun_rcv_irq: urb asynchronously failed - %d",
  184. urb->status);
  185. kingsun->receiving = 0;
  186. return;
  187. }
  188. if (urb->actual_length == kingsun->max_rx) {
  189. __u8 *bytes = urb->transfer_buffer;
  190. int i;
  191. /* The very first byte in the buffer indicates the length of
  192. valid data in the read. This byte must be in the range
  193. 1..kingsun->max_rx -1 . Values outside this range indicate
  194. an uninitialized Rx buffer when the dongle has just been
  195. plugged in. */
  196. if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) {
  197. for (i = 1; i <= bytes[0]; i++) {
  198. async_unwrap_char(kingsun->netdev,
  199. &kingsun->netdev->stats,
  200. &kingsun->rx_buff, bytes[i]);
  201. }
  202. do_gettimeofday(&kingsun->rx_time);
  203. kingsun->receiving =
  204. (kingsun->rx_buff.state != OUTSIDE_FRAME)
  205. ? 1 : 0;
  206. }
  207. } else if (urb->actual_length > 0) {
  208. err("%s(): Unexpected response length, expected %d got %d",
  209. __func__, kingsun->max_rx, urb->actual_length);
  210. }
  211. /* This urb has already been filled in kingsun_net_open */
  212. ret = usb_submit_urb(urb, GFP_ATOMIC);
  213. }
  214. /*
  215. * Function kingsun_net_open (dev)
  216. *
  217. * Network device is taken up. Usually this is done by "ifconfig irda0 up"
  218. */
  219. static int kingsun_net_open(struct net_device *netdev)
  220. {
  221. struct kingsun_cb *kingsun = netdev_priv(netdev);
  222. int err = -ENOMEM;
  223. char hwname[16];
  224. /* At this point, urbs are NULL, and skb is NULL (see kingsun_probe) */
  225. kingsun->receiving = 0;
  226. /* Initialize for SIR to copy data directly into skb. */
  227. kingsun->rx_buff.in_frame = FALSE;
  228. kingsun->rx_buff.state = OUTSIDE_FRAME;
  229. kingsun->rx_buff.truesize = IRDA_SKB_MAX_MTU;
  230. kingsun->rx_buff.skb = dev_alloc_skb(IRDA_SKB_MAX_MTU);
  231. if (!kingsun->rx_buff.skb)
  232. goto free_mem;
  233. skb_reserve(kingsun->rx_buff.skb, 1);
  234. kingsun->rx_buff.head = kingsun->rx_buff.skb->data;
  235. do_gettimeofday(&kingsun->rx_time);
  236. kingsun->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
  237. if (!kingsun->rx_urb)
  238. goto free_mem;
  239. kingsun->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
  240. if (!kingsun->tx_urb)
  241. goto free_mem;
  242. /*
  243. * Now that everything should be initialized properly,
  244. * Open new IrLAP layer instance to take care of us...
  245. */
  246. sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
  247. kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
  248. if (!kingsun->irlap) {
  249. err("kingsun-sir: irlap_open failed");
  250. goto free_mem;
  251. }
  252. /* Start first reception */
  253. usb_fill_int_urb(kingsun->rx_urb, kingsun->usbdev,
  254. usb_rcvintpipe(kingsun->usbdev, kingsun->ep_in),
  255. kingsun->in_buf, kingsun->max_rx,
  256. kingsun_rcv_irq, kingsun, 1);
  257. kingsun->rx_urb->status = 0;
  258. err = usb_submit_urb(kingsun->rx_urb, GFP_KERNEL);
  259. if (err) {
  260. err("kingsun-sir: first urb-submit failed: %d", err);
  261. goto close_irlap;
  262. }
  263. netif_start_queue(netdev);
  264. /* Situation at this point:
  265. - all work buffers allocated
  266. - urbs allocated and ready to fill
  267. - max rx packet known (in max_rx)
  268. - unwrap state machine initialized, in state outside of any frame
  269. - receive request in progress
  270. - IrLAP layer started, about to hand over packets to send
  271. */
  272. return 0;
  273. close_irlap:
  274. irlap_close(kingsun->irlap);
  275. free_mem:
  276. if (kingsun->tx_urb) {
  277. usb_free_urb(kingsun->tx_urb);
  278. kingsun->tx_urb = NULL;
  279. }
  280. if (kingsun->rx_urb) {
  281. usb_free_urb(kingsun->rx_urb);
  282. kingsun->rx_urb = NULL;
  283. }
  284. if (kingsun->rx_buff.skb) {
  285. kfree_skb(kingsun->rx_buff.skb);
  286. kingsun->rx_buff.skb = NULL;
  287. kingsun->rx_buff.head = NULL;
  288. }
  289. return err;
  290. }
  291. /*
  292. * Function kingsun_net_close (kingsun)
  293. *
  294. * Network device is taken down. Usually this is done by
  295. * "ifconfig irda0 down"
  296. */
  297. static int kingsun_net_close(struct net_device *netdev)
  298. {
  299. struct kingsun_cb *kingsun = netdev_priv(netdev);
  300. /* Stop transmit processing */
  301. netif_stop_queue(netdev);
  302. /* Mop up receive && transmit urb's */
  303. usb_kill_urb(kingsun->tx_urb);
  304. usb_kill_urb(kingsun->rx_urb);
  305. usb_free_urb(kingsun->tx_urb);
  306. usb_free_urb(kingsun->rx_urb);
  307. kingsun->tx_urb = NULL;
  308. kingsun->rx_urb = NULL;
  309. kfree_skb(kingsun->rx_buff.skb);
  310. kingsun->rx_buff.skb = NULL;
  311. kingsun->rx_buff.head = NULL;
  312. kingsun->rx_buff.in_frame = FALSE;
  313. kingsun->rx_buff.state = OUTSIDE_FRAME;
  314. kingsun->receiving = 0;
  315. /* Stop and remove instance of IrLAP */
  316. if (kingsun->irlap)
  317. irlap_close(kingsun->irlap);
  318. kingsun->irlap = NULL;
  319. return 0;
  320. }
  321. /*
  322. * IOCTLs : Extra out-of-band network commands...
  323. */
  324. static int kingsun_net_ioctl(struct net_device *netdev, struct ifreq *rq,
  325. int cmd)
  326. {
  327. struct if_irda_req *irq = (struct if_irda_req *) rq;
  328. struct kingsun_cb *kingsun = netdev_priv(netdev);
  329. int ret = 0;
  330. switch (cmd) {
  331. case SIOCSBANDWIDTH: /* Set bandwidth */
  332. if (!capable(CAP_NET_ADMIN))
  333. return -EPERM;
  334. /* Check if the device is still there */
  335. if (netif_device_present(kingsun->netdev))
  336. /* No observed commands for speed change */
  337. ret = -EOPNOTSUPP;
  338. break;
  339. case SIOCSMEDIABUSY: /* Set media busy */
  340. if (!capable(CAP_NET_ADMIN))
  341. return -EPERM;
  342. /* Check if the IrDA stack is still there */
  343. if (netif_running(kingsun->netdev))
  344. irda_device_set_media_busy(kingsun->netdev, TRUE);
  345. break;
  346. case SIOCGRECEIVING:
  347. /* Only approximately true */
  348. irq->ifr_receiving = kingsun->receiving;
  349. break;
  350. default:
  351. ret = -EOPNOTSUPP;
  352. }
  353. return ret;
  354. }
  355. static const struct net_device_ops kingsun_ops = {
  356. .ndo_start_xmit = kingsun_hard_xmit,
  357. .ndo_open = kingsun_net_open,
  358. .ndo_stop = kingsun_net_close,
  359. .ndo_do_ioctl = kingsun_net_ioctl,
  360. };
  361. /*
  362. * This routine is called by the USB subsystem for each new device
  363. * in the system. We need to check if the device is ours, and in
  364. * this case start handling it.
  365. */
  366. static int kingsun_probe(struct usb_interface *intf,
  367. const struct usb_device_id *id)
  368. {
  369. struct usb_host_interface *interface;
  370. struct usb_endpoint_descriptor *endpoint;
  371. struct usb_device *dev = interface_to_usbdev(intf);
  372. struct kingsun_cb *kingsun = NULL;
  373. struct net_device *net = NULL;
  374. int ret = -ENOMEM;
  375. int pipe, maxp_in, maxp_out;
  376. __u8 ep_in;
  377. __u8 ep_out;
  378. /* Check that there really are two interrupt endpoints.
  379. Check based on the one in drivers/usb/input/usbmouse.c
  380. */
  381. interface = intf->cur_altsetting;
  382. if (interface->desc.bNumEndpoints != 2) {
  383. err("kingsun-sir: expected 2 endpoints, found %d",
  384. interface->desc.bNumEndpoints);
  385. return -ENODEV;
  386. }
  387. endpoint = &interface->endpoint[KINGSUN_EP_IN].desc;
  388. if (!usb_endpoint_is_int_in(endpoint)) {
  389. err("kingsun-sir: endpoint 0 is not interrupt IN");
  390. return -ENODEV;
  391. }
  392. ep_in = endpoint->bEndpointAddress;
  393. pipe = usb_rcvintpipe(dev, ep_in);
  394. maxp_in = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
  395. if (maxp_in > 255 || maxp_in <= 1) {
  396. err("%s: endpoint 0 has max packet size %d not in range",
  397. __FILE__, maxp_in);
  398. return -ENODEV;
  399. }
  400. endpoint = &interface->endpoint[KINGSUN_EP_OUT].desc;
  401. if (!usb_endpoint_is_int_out(endpoint)) {
  402. err("kingsun-sir: endpoint 1 is not interrupt OUT");
  403. return -ENODEV;
  404. }
  405. ep_out = endpoint->bEndpointAddress;
  406. pipe = usb_sndintpipe(dev, ep_out);
  407. maxp_out = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
  408. /* Allocate network device container. */
  409. net = alloc_irdadev(sizeof(*kingsun));
  410. if(!net)
  411. goto err_out1;
  412. SET_NETDEV_DEV(net, &intf->dev);
  413. kingsun = netdev_priv(net);
  414. kingsun->irlap = NULL;
  415. kingsun->tx_urb = NULL;
  416. kingsun->rx_urb = NULL;
  417. kingsun->ep_in = ep_in;
  418. kingsun->ep_out = ep_out;
  419. kingsun->in_buf = NULL;
  420. kingsun->out_buf = NULL;
  421. kingsun->max_rx = (__u8)maxp_in;
  422. kingsun->max_tx = (__u8)maxp_out;
  423. kingsun->netdev = net;
  424. kingsun->usbdev = dev;
  425. kingsun->rx_buff.in_frame = FALSE;
  426. kingsun->rx_buff.state = OUTSIDE_FRAME;
  427. kingsun->rx_buff.skb = NULL;
  428. kingsun->receiving = 0;
  429. spin_lock_init(&kingsun->lock);
  430. /* Allocate input buffer */
  431. kingsun->in_buf = kmalloc(kingsun->max_rx, GFP_KERNEL);
  432. if (!kingsun->in_buf)
  433. goto free_mem;
  434. /* Allocate output buffer */
  435. kingsun->out_buf = kmalloc(KINGSUN_FIFO_SIZE, GFP_KERNEL);
  436. if (!kingsun->out_buf)
  437. goto free_mem;
  438. printk(KERN_INFO "KingSun/DonShine IRDA/USB found at address %d, "
  439. "Vendor: %x, Product: %x\n",
  440. dev->devnum, le16_to_cpu(dev->descriptor.idVendor),
  441. le16_to_cpu(dev->descriptor.idProduct));
  442. /* Initialize QoS for this device */
  443. irda_init_max_qos_capabilies(&kingsun->qos);
  444. /* That's the Rx capability. */
  445. kingsun->qos.baud_rate.bits &= IR_9600;
  446. kingsun->qos.min_turn_time.bits &= KINGSUN_MTT;
  447. irda_qos_bits_to_value(&kingsun->qos);
  448. /* Override the network functions we need to use */
  449. net->netdev_ops = &kingsun_ops;
  450. ret = register_netdev(net);
  451. if (ret != 0)
  452. goto free_mem;
  453. dev_info(&net->dev, "IrDA: Registered KingSun/DonShine device %s\n",
  454. net->name);
  455. usb_set_intfdata(intf, kingsun);
  456. /* Situation at this point:
  457. - all work buffers allocated
  458. - urbs not allocated, set to NULL
  459. - max rx packet known (in max_rx)
  460. - unwrap state machine (partially) initialized, but skb == NULL
  461. */
  462. return 0;
  463. free_mem:
  464. if (kingsun->out_buf) kfree(kingsun->out_buf);
  465. if (kingsun->in_buf) kfree(kingsun->in_buf);
  466. free_netdev(net);
  467. err_out1:
  468. return ret;
  469. }
  470. /*
  471. * The current device is removed, the USB layer tell us to shut it down...
  472. */
  473. static void kingsun_disconnect(struct usb_interface *intf)
  474. {
  475. struct kingsun_cb *kingsun = usb_get_intfdata(intf);
  476. if (!kingsun)
  477. return;
  478. unregister_netdev(kingsun->netdev);
  479. /* Mop up receive && transmit urb's */
  480. if (kingsun->tx_urb != NULL) {
  481. usb_kill_urb(kingsun->tx_urb);
  482. usb_free_urb(kingsun->tx_urb);
  483. kingsun->tx_urb = NULL;
  484. }
  485. if (kingsun->rx_urb != NULL) {
  486. usb_kill_urb(kingsun->rx_urb);
  487. usb_free_urb(kingsun->rx_urb);
  488. kingsun->rx_urb = NULL;
  489. }
  490. kfree(kingsun->out_buf);
  491. kfree(kingsun->in_buf);
  492. free_netdev(kingsun->netdev);
  493. usb_set_intfdata(intf, NULL);
  494. }
  495. #ifdef CONFIG_PM
  496. /* USB suspend, so power off the transmitter/receiver */
  497. static int kingsun_suspend(struct usb_interface *intf, pm_message_t message)
  498. {
  499. struct kingsun_cb *kingsun = usb_get_intfdata(intf);
  500. netif_device_detach(kingsun->netdev);
  501. if (kingsun->tx_urb != NULL) usb_kill_urb(kingsun->tx_urb);
  502. if (kingsun->rx_urb != NULL) usb_kill_urb(kingsun->rx_urb);
  503. return 0;
  504. }
  505. /* Coming out of suspend, so reset hardware */
  506. static int kingsun_resume(struct usb_interface *intf)
  507. {
  508. struct kingsun_cb *kingsun = usb_get_intfdata(intf);
  509. if (kingsun->rx_urb != NULL)
  510. usb_submit_urb(kingsun->rx_urb, GFP_KERNEL);
  511. netif_device_attach(kingsun->netdev);
  512. return 0;
  513. }
  514. #endif
  515. /*
  516. * USB device callbacks
  517. */
  518. static struct usb_driver irda_driver = {
  519. .name = "kingsun-sir",
  520. .probe = kingsun_probe,
  521. .disconnect = kingsun_disconnect,
  522. .id_table = dongles,
  523. #ifdef CONFIG_PM
  524. .suspend = kingsun_suspend,
  525. .resume = kingsun_resume,
  526. #endif
  527. };
  528. module_usb_driver(irda_driver);
  529. MODULE_AUTHOR("Alex Villacís Lasso <a_villacis@palosanto.com>");
  530. MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun/DonShine");
  531. MODULE_LICENSE("GPL");