1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57#include <linux/module.h>
58#include <linux/moduleparam.h>
59#include <linux/kernel.h>
60#include <linux/types.h>
61#include <linux/init.h>
62#include <linux/skbuff.h>
63#include <linux/netdevice.h>
64#include <linux/slab.h>
65#include <linux/rtnetlink.h>
66#include <linux/usb.h>
67#include <linux/firmware.h>
68
69#include "irda-usb.h"
70
71
72
73static int qos_mtt_bits = 0;
74
75
76static struct usb_device_id dongles[] = {
77
78 { USB_DEVICE(0x9c4, 0x011), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
79
80 { USB_DEVICE(0x4428, 0x012), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
81
82 { USB_DEVICE(0x50f, 0x180), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
83
84 { USB_DEVICE(0x8e9, 0x100), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
85
86 { USB_DEVICE(0x66f, 0x4210), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
87 { USB_DEVICE(0x66f, 0x4220), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
88 { USB_DEVICE(0x66f, 0x4116), .driver_info = IUC_STIR421X | IUC_SPEED_BUG },
89 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
90 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
91 .bInterfaceClass = USB_CLASS_APP_SPEC,
92 .bInterfaceSubClass = USB_CLASS_IRDA,
93 .driver_info = IUC_DEFAULT, },
94 { },
95};
96
97
98
99
100
101
102
103
104
105
106MODULE_DEVICE_TABLE(usb, dongles);
107
108
109
110static void irda_usb_init_qos(struct irda_usb_cb *self) ;
111static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf);
112static void irda_usb_disconnect(struct usb_interface *intf);
113static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
114static netdev_tx_t irda_usb_hard_xmit(struct sk_buff *skb,
115 struct net_device *dev);
116static int irda_usb_open(struct irda_usb_cb *self);
117static void irda_usb_close(struct irda_usb_cb *self);
118static void speed_bulk_callback(struct urb *urb);
119static void write_bulk_callback(struct urb *urb);
120static void irda_usb_receive(struct urb *urb);
121static void irda_usb_rx_defer_expired(unsigned long data);
122static int irda_usb_net_open(struct net_device *dev);
123static int irda_usb_net_close(struct net_device *dev);
124static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
125static void irda_usb_net_timeout(struct net_device *dev);
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149static void irda_usb_build_header(struct irda_usb_cb *self,
150 __u8 *header,
151 int force)
152{
153
154
155
156
157 if (self->capability & IUC_STIR421X &&
158 ((self->new_speed != -1) || (self->new_xbofs != -1))) {
159
160
161
162
163 if (self->new_speed == -1)
164 self->new_speed = self->speed ;
165
166 if (self->new_xbofs == -1)
167 self->new_xbofs = self->xbofs ;
168 }
169
170
171 if (self->new_speed != -1) {
172
173
174
175
176 if ((self->capability & IUC_SPEED_BUG) &&
177 (!force) && (self->speed != -1)) {
178
179
180 IRDA_DEBUG(2, "%s(), not changing speed yet\n", __func__);
181 *header = 0;
182 return;
183 }
184
185 IRDA_DEBUG(2, "%s(), changing speed to %d\n", __func__, self->new_speed);
186 self->speed = self->new_speed;
187
188
189
190 switch (self->speed) {
191 case 2400:
192 *header = SPEED_2400;
193 break;
194 default:
195 case 9600:
196 *header = SPEED_9600;
197 break;
198 case 19200:
199 *header = SPEED_19200;
200 break;
201 case 38400:
202 *header = SPEED_38400;
203 break;
204 case 57600:
205 *header = SPEED_57600;
206 break;
207 case 115200:
208 *header = SPEED_115200;
209 break;
210 case 576000:
211 *header = SPEED_576000;
212 break;
213 case 1152000:
214 *header = SPEED_1152000;
215 break;
216 case 4000000:
217 *header = SPEED_4000000;
218 self->new_xbofs = 0;
219 break;
220 case 16000000:
221 *header = SPEED_16000000;
222 self->new_xbofs = 0;
223 break;
224 }
225 } else
226
227 *header = 0;
228
229
230 if (self->new_xbofs != -1) {
231 IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __func__, self->new_xbofs);
232 self->xbofs = self->new_xbofs;
233
234
235
236 switch (self->xbofs) {
237 case 48:
238 *header |= 0x10;
239 break;
240 case 28:
241 case 24:
242 *header |= 0x20;
243 break;
244 default:
245 case 12:
246 *header |= 0x30;
247 break;
248 case 5:
249 case 6:
250 *header |= 0x40;
251 break;
252 case 3:
253 *header |= 0x50;
254 break;
255 case 2:
256 *header |= 0x60;
257 break;
258 case 1:
259 *header |= 0x70;
260 break;
261 case 0:
262 *header |= 0x80;
263 break;
264 }
265 }
266}
267
268
269
270
271static __u8 get_turnaround_time(struct sk_buff *skb)
272{
273 int turnaround_time = irda_get_mtt(skb);
274
275 if ( turnaround_time == 0 )
276 return 0;
277 else if ( turnaround_time <= 10 )
278 return 1;
279 else if ( turnaround_time <= 50 )
280 return 2;
281 else if ( turnaround_time <= 100 )
282 return 3;
283 else if ( turnaround_time <= 500 )
284 return 4;
285 else if ( turnaround_time <= 1000 )
286 return 5;
287 else if ( turnaround_time <= 5000 )
288 return 6;
289 else
290 return 7;
291}
292
293
294
295
296
297
298
299static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
300{
301 __u8 *frame;
302 struct urb *urb;
303 int ret;
304
305 IRDA_DEBUG(2, "%s(), speed=%d, xbofs=%d\n", __func__,
306 self->new_speed, self->new_xbofs);
307
308
309 urb = self->speed_urb;
310 if (urb->status != 0) {
311 IRDA_WARNING("%s(), URB still in use!\n", __func__);
312 return;
313 }
314
315
316 frame = self->speed_buff;
317
318
319 irda_usb_build_header(self, frame, 1);
320
321 if (self->capability & IUC_STIR421X) {
322 if (frame[0] == 0) return ;
323 frame[1] = 0;
324 frame[2] = 0;
325 }
326
327
328 usb_fill_bulk_urb(urb, self->usbdev,
329 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
330 frame, IRDA_USB_SPEED_MTU,
331 speed_bulk_callback, self);
332 urb->transfer_buffer_length = self->header_length;
333 urb->transfer_flags = 0;
334
335
336 if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
337 IRDA_WARNING("%s(), failed Speed URB\n", __func__);
338 }
339}
340
341
342
343
344
345
346static void speed_bulk_callback(struct urb *urb)
347{
348 struct irda_usb_cb *self = urb->context;
349
350 IRDA_DEBUG(2, "%s()\n", __func__);
351
352
353 IRDA_ASSERT(self != NULL, return;);
354
355 IRDA_ASSERT(urb == self->speed_urb, return;);
356
357
358 if (urb->status != 0) {
359
360 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
361
362
363
364
365
366
367 return;
368 }
369
370
371
372
373
374 self->new_speed = -1;
375 self->new_xbofs = -1;
376
377
378 netif_wake_queue(self->netdev);
379}
380
381
382
383
384
385static netdev_tx_t irda_usb_hard_xmit(struct sk_buff *skb,
386 struct net_device *netdev)
387{
388 struct irda_usb_cb *self = netdev_priv(netdev);
389 struct urb *urb = self->tx_urb;
390 unsigned long flags;
391 s32 speed;
392 s16 xbofs;
393 int res, mtt;
394
395 IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name);
396
397 netif_stop_queue(netdev);
398
399
400 spin_lock_irqsave(&self->lock, flags);
401
402
403
404
405 if (!self->present) {
406 IRDA_DEBUG(0, "%s(), Device is gone...\n", __func__);
407 goto drop;
408 }
409
410
411 xbofs = irda_get_next_xbofs(skb);
412 if ((xbofs != self->xbofs) && (xbofs != -1)) {
413 self->new_xbofs = xbofs;
414 }
415
416
417 speed = irda_get_next_speed(skb);
418 if ((speed != self->speed) && (speed != -1)) {
419
420 self->new_speed = speed;
421
422
423 if (!skb->len) {
424
425
426
427
428
429
430
431 irda_usb_change_speed_xbofs(self);
432 netdev->trans_start = jiffies;
433
434 goto drop;
435 }
436 }
437
438 if (urb->status != 0) {
439 IRDA_WARNING("%s(), URB still in use!\n", __func__);
440 goto drop;
441 }
442
443 skb_copy_from_linear_data(skb, self->tx_buff + self->header_length, skb->len);
444
445
446 if (self->capability & IUC_STIR421X) {
447 __u8 turnaround_time;
448 __u8* frame = self->tx_buff;
449 turnaround_time = get_turnaround_time( skb );
450 irda_usb_build_header(self, frame, 0);
451 frame[2] = turnaround_time;
452 if ((skb->len != 0) &&
453 ((skb->len % 128) == 0) &&
454 ((skb->len % 512) != 0)) {
455
456 frame[1] = 1;
457 skb_put(skb, 1);
458 } else {
459 frame[1] = 0;
460 }
461 } else {
462 irda_usb_build_header(self, self->tx_buff, 0);
463 }
464
465
466 ((struct irda_skb_cb *)skb->cb)->context = self;
467
468 usb_fill_bulk_urb(urb, self->usbdev,
469 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
470 self->tx_buff, skb->len + self->header_length,
471 write_bulk_callback, skb);
472
473
474
475
476
477
478 urb->transfer_flags = URB_ZERO_PACKET;
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494 if (self->capability & IUC_NO_TURN) {
495 mtt = irda_get_mtt(skb);
496 if (mtt) {
497 int diff;
498 do_gettimeofday(&self->now);
499 diff = self->now.tv_usec - self->stamp.tv_usec;
500#ifdef IU_USB_MIN_RTT
501
502
503 diff += IU_USB_MIN_RTT;
504#endif
505
506
507
508 if (diff < 0)
509 diff += 1000000;
510
511
512
513
514 if (mtt > diff) {
515 mtt -= diff;
516 if (mtt > 1000)
517 mdelay(mtt/1000);
518 else
519 udelay(mtt);
520 }
521 }
522 }
523
524
525 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
526 IRDA_WARNING("%s(), failed Tx URB\n", __func__);
527 netdev->stats.tx_errors++;
528
529
530 } else {
531
532 netdev->stats.tx_packets++;
533 netdev->stats.tx_bytes += skb->len;
534
535 netdev->trans_start = jiffies;
536 }
537 spin_unlock_irqrestore(&self->lock, flags);
538
539 return NETDEV_TX_OK;
540
541drop:
542
543 dev_kfree_skb(skb);
544 spin_unlock_irqrestore(&self->lock, flags);
545 return NETDEV_TX_OK;
546}
547
548
549
550
551
552static void write_bulk_callback(struct urb *urb)
553{
554 unsigned long flags;
555 struct sk_buff *skb = urb->context;
556 struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context;
557
558 IRDA_DEBUG(2, "%s()\n", __func__);
559
560
561 IRDA_ASSERT(self != NULL, return;);
562
563 IRDA_ASSERT(urb == self->tx_urb, return;);
564
565
566 dev_kfree_skb_any(skb);
567 urb->context = NULL;
568
569
570 if (urb->status != 0) {
571
572 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
573
574
575
576
577
578
579
580 return;
581 }
582
583
584
585
586
587 spin_lock_irqsave(&self->lock, flags);
588
589
590 if ((!self->netopen) || (!self->present)) {
591 IRDA_DEBUG(0, "%s(), Network is gone...\n", __func__);
592 spin_unlock_irqrestore(&self->lock, flags);
593 return;
594 }
595
596
597 if ((self->new_speed != -1) || (self->new_xbofs != -1)) {
598 if ((self->new_speed != self->speed) ||
599 (self->new_xbofs != self->xbofs)) {
600
601
602 IRDA_DEBUG(1, "%s(), Changing speed now...\n", __func__);
603 irda_usb_change_speed_xbofs(self);
604 } else {
605
606 self->new_speed = -1;
607 self->new_xbofs = -1;
608
609 netif_wake_queue(self->netdev);
610 }
611 } else {
612
613 netif_wake_queue(self->netdev);
614 }
615 spin_unlock_irqrestore(&self->lock, flags);
616}
617
618
619
620
621
622
623
624
625
626
627static void irda_usb_net_timeout(struct net_device *netdev)
628{
629 unsigned long flags;
630 struct irda_usb_cb *self = netdev_priv(netdev);
631 struct urb *urb;
632 int done = 0;
633
634 IRDA_DEBUG(0, "%s(), Network layer thinks we timed out!\n", __func__);
635 IRDA_ASSERT(self != NULL, return;);
636
637
638 spin_lock_irqsave(&self->lock, flags);
639
640
641 if (!self->present) {
642 IRDA_WARNING("%s(), device not present!\n", __func__);
643 netif_stop_queue(netdev);
644 spin_unlock_irqrestore(&self->lock, flags);
645 return;
646 }
647
648
649 urb = self->speed_urb;
650 if (urb->status != 0) {
651 IRDA_DEBUG(0, "%s: Speed change timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
652
653 switch (urb->status) {
654 case -EINPROGRESS:
655 usb_unlink_urb(urb);
656
657
658
659 done = 1;
660 break;
661 case -ECONNRESET:
662 case -ENOENT:
663 default:
664 urb->status = 0;
665 netif_wake_queue(self->netdev);
666 done = 1;
667 break;
668 }
669 }
670
671
672 urb = self->tx_urb;
673 if (urb->status != 0) {
674 struct sk_buff *skb = urb->context;
675
676 IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
677
678
679 netdev->stats.tx_errors++;
680
681#ifdef IU_BUG_KICK_TIMEOUT
682
683 if(self->new_speed == -1)
684 self->new_speed = self->speed;
685 if(self->new_xbofs == -1)
686 self->new_xbofs = self->xbofs;
687 irda_usb_change_speed_xbofs(self);
688#endif
689
690 switch (urb->status) {
691 case -EINPROGRESS:
692 usb_unlink_urb(urb);
693
694
695
696
697
698 done = 1;
699 break;
700 case -ECONNRESET:
701 case -ENOENT:
702 default:
703 if(skb != NULL) {
704 dev_kfree_skb_any(skb);
705 urb->context = NULL;
706 }
707 urb->status = 0;
708 netif_wake_queue(self->netdev);
709 done = 1;
710 break;
711 }
712 }
713 spin_unlock_irqrestore(&self->lock, flags);
714
715
716
717
718
719
720
721}
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struct urb *urb)
761{
762 struct irda_skb_cb *cb;
763 int ret;
764
765 IRDA_DEBUG(2, "%s()\n", __func__);
766
767
768 IRDA_ASSERT(skb != NULL, return;);
769 IRDA_ASSERT(urb != NULL, return;);
770
771
772 cb = (struct irda_skb_cb *) skb->cb;
773 cb->context = self;
774
775
776 usb_fill_bulk_urb(urb, self->usbdev,
777 usb_rcvbulkpipe(self->usbdev, self->bulk_in_ep),
778 skb->data, IRDA_SKB_MAX_MTU,
779 irda_usb_receive, skb);
780 urb->status = 0;
781
782
783 ret = usb_submit_urb(urb, GFP_ATOMIC);
784 if (ret) {
785
786
787 IRDA_WARNING("%s(), Failed to submit Rx URB %d\n",
788 __func__, ret);
789 }
790}
791
792
793
794
795
796
797
798
799static void irda_usb_receive(struct urb *urb)
800{
801 struct sk_buff *skb = (struct sk_buff *) urb->context;
802 struct irda_usb_cb *self;
803 struct irda_skb_cb *cb;
804 struct sk_buff *newskb;
805 struct sk_buff *dataskb;
806 struct urb *next_urb;
807 unsigned int len, docopy;
808
809 IRDA_DEBUG(2, "%s(), len=%d\n", __func__, urb->actual_length);
810
811
812 cb = (struct irda_skb_cb *) skb->cb;
813 IRDA_ASSERT(cb != NULL, return;);
814 self = (struct irda_usb_cb *) cb->context;
815 IRDA_ASSERT(self != NULL, return;);
816
817
818 if ((!self->netopen) || (!self->present)) {
819 IRDA_DEBUG(0, "%s(), Network is gone!\n", __func__);
820
821 return;
822 }
823
824
825 if (urb->status != 0) {
826 switch (urb->status) {
827 case -EILSEQ:
828 self->netdev->stats.rx_crc_errors++;
829
830
831 case -ECONNRESET:
832
833
834
835
836 case -ESHUTDOWN:
837
838 case -ETIME:
839
840 default:
841 self->netdev->stats.rx_errors++;
842 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
843 break;
844 }
845
846
847
848
849
850
851
852
853
854
855 self->rx_defer_timer.function = irda_usb_rx_defer_expired;
856 self->rx_defer_timer.data = (unsigned long) urb;
857 mod_timer(&self->rx_defer_timer, jiffies + (10 * HZ / 1000));
858 return;
859 }
860
861
862 if (urb->actual_length <= self->header_length) {
863 IRDA_WARNING("%s(), empty frame!\n", __func__);
864 goto done;
865 }
866
867
868
869
870
871
872 do_gettimeofday(&self->stamp);
873
874
875
876
877
878
879
880 docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD);
881
882
883 if (self->capability & IUC_STIR421X)
884 newskb = dev_alloc_skb(docopy ? urb->actual_length :
885 IRDA_SKB_MAX_MTU +
886 USB_IRDA_STIR421X_HEADER);
887 else
888 newskb = dev_alloc_skb(docopy ? urb->actual_length :
889 IRDA_SKB_MAX_MTU);
890
891 if (!newskb) {
892 self->netdev->stats.rx_dropped++;
893
894
895 goto done;
896 }
897
898
899
900
901
902 if(docopy) {
903
904 skb_copy_from_linear_data(skb, newskb->data, urb->actual_length);
905
906 dataskb = newskb;
907
908
909
910 } else {
911
912 dataskb = skb;
913
914 skb = newskb;
915 }
916
917
918 skb_put(dataskb, urb->actual_length);
919 skb_pull(dataskb, self->header_length);
920
921
922 dataskb->dev = self->netdev;
923 skb_reset_mac_header(dataskb);
924 dataskb->protocol = htons(ETH_P_IRDA);
925 len = dataskb->len;
926 netif_rx(dataskb);
927
928
929 self->netdev->stats.rx_bytes += len;
930 self->netdev->stats.rx_packets++;
931
932done:
933
934
935
936
937
938
939
940
941
942
943
944 next_urb = self->idle_rx_urb;
945
946
947 urb->context = NULL;
948 self->idle_rx_urb = urb;
949
950
951
952 irda_usb_submit(self, skb, next_urb);
953}
954
955
956
957
958
959
960static void irda_usb_rx_defer_expired(unsigned long data)
961{
962 struct urb *urb = (struct urb *) data;
963 struct sk_buff *skb = (struct sk_buff *) urb->context;
964 struct irda_usb_cb *self;
965 struct irda_skb_cb *cb;
966 struct urb *next_urb;
967
968 IRDA_DEBUG(2, "%s()\n", __func__);
969
970
971 cb = (struct irda_skb_cb *) skb->cb;
972 IRDA_ASSERT(cb != NULL, return;);
973 self = (struct irda_usb_cb *) cb->context;
974 IRDA_ASSERT(self != NULL, return;);
975
976
977 next_urb = self->idle_rx_urb;
978 urb->context = NULL;
979 self->idle_rx_urb = urb;
980 irda_usb_submit(self, skb, next_urb);
981}
982
983
984
985
986
987
988static int irda_usb_is_receiving(struct irda_usb_cb *self)
989{
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007 return 0;
1008}
1009
1010#define STIR421X_PATCH_PRODUCT_VER "Product Version: "
1011#define STIR421X_PATCH_STMP_TAG "STMP"
1012#define STIR421X_PATCH_CODE_OFFSET 512
1013
1014#define STIR421X_PATCH_END_OF_HDR_TAG 0x1A
1015#define STIR421X_PATCH_BLOCK_SIZE 1023
1016
1017
1018
1019
1020
1021
1022
1023
1024static int stir421x_fw_upload(struct irda_usb_cb *self,
1025 const unsigned char *patch,
1026 const unsigned int patch_len)
1027{
1028 int ret = -ENOMEM;
1029 int actual_len = 0;
1030 unsigned int i;
1031 unsigned int block_size = 0;
1032 unsigned char *patch_block;
1033
1034 patch_block = kzalloc(STIR421X_PATCH_BLOCK_SIZE, GFP_KERNEL);
1035 if (patch_block == NULL)
1036 return -ENOMEM;
1037
1038
1039 for (i = 0; i < patch_len; i += block_size) {
1040 block_size = patch_len - i;
1041
1042 if (block_size > STIR421X_PATCH_BLOCK_SIZE)
1043 block_size = STIR421X_PATCH_BLOCK_SIZE;
1044
1045
1046 memcpy(patch_block, patch + i, block_size);
1047
1048 ret = usb_bulk_msg(self->usbdev,
1049 usb_sndbulkpipe(self->usbdev,
1050 self->bulk_out_ep),
1051 patch_block, block_size,
1052 &actual_len, msecs_to_jiffies(500));
1053 IRDA_DEBUG(3,"%s(): Bulk send %u bytes, ret=%d\n",
1054 __func__, actual_len, ret);
1055
1056 if (ret < 0)
1057 break;
1058
1059 mdelay(10);
1060 }
1061
1062 kfree(patch_block);
1063
1064 return ret;
1065 }
1066
1067
1068
1069
1070
1071
1072static int stir421x_patch_device(struct irda_usb_cb *self)
1073{
1074 unsigned int i;
1075 int ret;
1076 char stir421x_fw_name[12];
1077 const struct firmware *fw;
1078 const unsigned char *fw_version_ptr;
1079 unsigned long fw_version = 0;
1080
1081
1082
1083
1084
1085 sprintf(stir421x_fw_name, "4210%4X.sb",
1086 self->usbdev->descriptor.bcdDevice);
1087 ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev);
1088 if (ret < 0)
1089 return ret;
1090
1091
1092 IRDA_MESSAGE("%s(): Received firmware %s (%zu bytes)\n",
1093 __func__, stir421x_fw_name, fw->size);
1094
1095 ret = -EINVAL;
1096
1097
1098 if (!memcmp(fw->data, STIR421X_PATCH_PRODUCT_VER,
1099 sizeof(STIR421X_PATCH_PRODUCT_VER) - 1)) {
1100 fw_version_ptr = fw->data +
1101 sizeof(STIR421X_PATCH_PRODUCT_VER) - 1;
1102
1103
1104 if (fw_version_ptr[3] == '.' &&
1105 fw_version_ptr[7] == '.') {
1106 unsigned long major, minor, build;
1107 major = simple_strtoul(fw_version_ptr, NULL, 10);
1108 minor = simple_strtoul(fw_version_ptr + 4, NULL, 10);
1109 build = simple_strtoul(fw_version_ptr + 8, NULL, 10);
1110
1111 fw_version = (major << 12)
1112 + (minor << 8)
1113 + ((build / 10) << 4)
1114 + (build % 10);
1115
1116 IRDA_DEBUG(3, "%s(): Firmware Product version %ld\n",
1117 __func__, fw_version);
1118 }
1119 }
1120
1121 if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) {
1122
1123
1124
1125
1126
1127 for (i = 0; i < fw->size && fw->data[i] !=
1128 STIR421X_PATCH_END_OF_HDR_TAG; i++) ;
1129
1130 if (i < STIR421X_PATCH_CODE_OFFSET && i < fw->size &&
1131 STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) {
1132 if (!memcmp(fw->data + i + 1, STIR421X_PATCH_STMP_TAG,
1133 sizeof(STIR421X_PATCH_STMP_TAG) - 1)) {
1134
1135
1136 i += sizeof(STIR421X_PATCH_STMP_TAG);
1137 ret = stir421x_fw_upload(self, &fw->data[i],
1138 fw->size - i);
1139 }
1140 }
1141 }
1142
1143 release_firmware(fw);
1144
1145 return ret;
1146}
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166static int irda_usb_net_open(struct net_device *netdev)
1167{
1168 struct irda_usb_cb *self;
1169 unsigned long flags;
1170 char hwname[16];
1171 int i;
1172
1173 IRDA_DEBUG(1, "%s()\n", __func__);
1174
1175 IRDA_ASSERT(netdev != NULL, return -1;);
1176 self = netdev_priv(netdev);
1177 IRDA_ASSERT(self != NULL, return -1;);
1178
1179 spin_lock_irqsave(&self->lock, flags);
1180
1181 if(!self->present) {
1182 spin_unlock_irqrestore(&self->lock, flags);
1183 IRDA_WARNING("%s(), device not present!\n", __func__);
1184 return -1;
1185 }
1186
1187 if(self->needspatch) {
1188 spin_unlock_irqrestore(&self->lock, flags);
1189 IRDA_WARNING("%s(), device needs patch\n", __func__) ;
1190 return -EIO ;
1191 }
1192
1193
1194
1195 self->speed = -1;
1196 self->xbofs = -1;
1197 self->new_speed = -1;
1198 self->new_xbofs = -1;
1199
1200
1201
1202 self->netopen = 1;
1203 spin_unlock_irqrestore(&self->lock, flags);
1204
1205
1206
1207
1208
1209
1210 sprintf(hwname, "usb#%d", self->usbdev->devnum);
1211 self->irlap = irlap_open(netdev, &self->qos, hwname);
1212 IRDA_ASSERT(self->irlap != NULL, return -1;);
1213
1214
1215 netif_start_queue(netdev);
1216
1217
1218
1219
1220
1221 self->idle_rx_urb = self->rx_urb[IU_MAX_ACTIVE_RX_URBS];
1222 self->idle_rx_urb->context = NULL;
1223
1224
1225
1226 for (i = 0; i < IU_MAX_ACTIVE_RX_URBS; i++) {
1227 struct sk_buff *skb = dev_alloc_skb(IRDA_SKB_MAX_MTU);
1228 if (!skb) {
1229
1230
1231 IRDA_WARNING("%s(), Failed to allocate Rx skb\n",
1232 __func__);
1233 return -1;
1234 }
1235
1236 irda_usb_submit(self, skb, self->rx_urb[i]);
1237 }
1238
1239
1240 return 0;
1241}
1242
1243
1244
1245
1246
1247
1248
1249
1250static int irda_usb_net_close(struct net_device *netdev)
1251{
1252 struct irda_usb_cb *self;
1253 int i;
1254
1255 IRDA_DEBUG(1, "%s()\n", __func__);
1256
1257 IRDA_ASSERT(netdev != NULL, return -1;);
1258 self = netdev_priv(netdev);
1259 IRDA_ASSERT(self != NULL, return -1;);
1260
1261
1262
1263 self->netopen = 0;
1264
1265
1266 netif_stop_queue(netdev);
1267
1268
1269 del_timer(&self->rx_defer_timer);
1270
1271
1272 for (i = 0; i < self->max_rx_urb; i++) {
1273 struct urb *urb = self->rx_urb[i];
1274 struct sk_buff *skb = (struct sk_buff *) urb->context;
1275
1276 usb_kill_urb(urb);
1277
1278 if(skb) {
1279 dev_kfree_skb(skb);
1280 urb->context = NULL;
1281 }
1282 }
1283
1284 usb_kill_urb(self->tx_urb);
1285 usb_kill_urb(self->speed_urb);
1286
1287
1288 if (self->irlap)
1289 irlap_close(self->irlap);
1290 self->irlap = NULL;
1291
1292 return 0;
1293}
1294
1295
1296
1297
1298
1299static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1300{
1301 unsigned long flags;
1302 struct if_irda_req *irq = (struct if_irda_req *) rq;
1303 struct irda_usb_cb *self;
1304 int ret = 0;
1305
1306 IRDA_ASSERT(dev != NULL, return -1;);
1307 self = netdev_priv(dev);
1308 IRDA_ASSERT(self != NULL, return -1;);
1309
1310 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
1311
1312 switch (cmd) {
1313 case SIOCSBANDWIDTH:
1314 if (!capable(CAP_NET_ADMIN))
1315 return -EPERM;
1316
1317 spin_lock_irqsave(&self->lock, flags);
1318
1319 if(self->present) {
1320
1321 self->new_speed = irq->ifr_baudrate;
1322 irda_usb_change_speed_xbofs(self);
1323 }
1324 spin_unlock_irqrestore(&self->lock, flags);
1325 break;
1326 case SIOCSMEDIABUSY:
1327 if (!capable(CAP_NET_ADMIN))
1328 return -EPERM;
1329
1330 if(self->netopen)
1331 irda_device_set_media_busy(self->netdev, TRUE);
1332 break;
1333 case SIOCGRECEIVING:
1334 irq->ifr_receiving = irda_usb_is_receiving(self);
1335 break;
1336 default:
1337 ret = -EOPNOTSUPP;
1338 }
1339
1340 return ret;
1341}
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356static inline void irda_usb_init_qos(struct irda_usb_cb *self)
1357{
1358 struct irda_class_desc *desc;
1359
1360 IRDA_DEBUG(3, "%s()\n", __func__);
1361
1362 desc = self->irda_desc;
1363
1364
1365 irda_init_max_qos_capabilies(&self->qos);
1366
1367
1368
1369
1370 self->qos.baud_rate.bits = le16_to_cpu(desc->wBaudRate);
1371 self->qos.min_turn_time.bits = desc->bmMinTurnaroundTime;
1372 self->qos.additional_bofs.bits = desc->bmAdditionalBOFs;
1373 self->qos.window_size.bits = desc->bmWindowSize;
1374 self->qos.data_size.bits = desc->bmDataSize;
1375
1376 IRDA_DEBUG(0, "%s(), dongle says speed=0x%X, size=0x%X, window=0x%X, bofs=0x%X, turn=0x%X\n",
1377 __func__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qos.additional_bofs.bits, self->qos.min_turn_time.bits);
1378
1379
1380 if(self->capability & IUC_SIR_ONLY)
1381 self->qos.baud_rate.bits &= 0x00ff;
1382 if(self->capability & IUC_SMALL_PKT)
1383 self->qos.data_size.bits = 0x07;
1384 if(self->capability & IUC_NO_WINDOW)
1385 self->qos.window_size.bits = 0x01;
1386 if(self->capability & IUC_MAX_WINDOW)
1387 self->qos.window_size.bits = 0x7f;
1388 if(self->capability & IUC_MAX_XBOFS)
1389 self->qos.additional_bofs.bits = 0x01;
1390
1391#if 1
1392
1393 if (qos_mtt_bits)
1394 self->qos.min_turn_time.bits = qos_mtt_bits;
1395#endif
1396
1397
1398
1399
1400 irda_qos_bits_to_value(&self->qos);
1401}
1402
1403
1404static const struct net_device_ops irda_usb_netdev_ops = {
1405 .ndo_open = irda_usb_net_open,
1406 .ndo_stop = irda_usb_net_close,
1407 .ndo_do_ioctl = irda_usb_net_ioctl,
1408 .ndo_start_xmit = irda_usb_hard_xmit,
1409 .ndo_tx_timeout = irda_usb_net_timeout,
1410};
1411
1412
1413
1414
1415
1416static inline int irda_usb_open(struct irda_usb_cb *self)
1417{
1418 struct net_device *netdev = self->netdev;
1419
1420 IRDA_DEBUG(1, "%s()\n", __func__);
1421
1422 netdev->netdev_ops = &irda_usb_netdev_ops;
1423
1424 irda_usb_init_qos(self);
1425
1426 return register_netdev(netdev);
1427}
1428
1429
1430
1431
1432
1433
1434static inline void irda_usb_close(struct irda_usb_cb *self)
1435{
1436 IRDA_DEBUG(1, "%s()\n", __func__);
1437
1438
1439 unregister_netdev(self->netdev);
1440
1441
1442 kfree(self->speed_buff);
1443 self->speed_buff = NULL;
1444
1445 kfree(self->tx_buff);
1446 self->tx_buff = NULL;
1447}
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_host_endpoint *endpoint, int ennum)
1469{
1470 int i;
1471
1472
1473 self->bulk_in_ep = 0;
1474 self->bulk_out_ep = 0;
1475 self->bulk_int_ep = 0;
1476
1477
1478 for(i = 0; i < ennum; i++) {
1479
1480
1481 __u8 ep;
1482 __u8 dir;
1483 __u8 attr;
1484 __u16 psize;
1485
1486
1487 ep = endpoint[i].desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
1488 dir = endpoint[i].desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK;
1489 attr = endpoint[i].desc.bmAttributes;
1490 psize = le16_to_cpu(endpoint[i].desc.wMaxPacketSize);
1491
1492
1493 if(attr == USB_ENDPOINT_XFER_BULK) {
1494
1495 if(dir == USB_DIR_IN) {
1496
1497 self->bulk_in_ep = ep;
1498 } else {
1499
1500 self->bulk_out_ep = ep;
1501 self->bulk_out_mtu = psize;
1502 }
1503 } else {
1504 if((attr == USB_ENDPOINT_XFER_INT) &&
1505 (dir == USB_DIR_IN)) {
1506
1507 self->bulk_int_ep = ep;
1508 } else {
1509 IRDA_ERROR("%s(), Unrecognised endpoint %02X.\n", __func__, ep);
1510 }
1511 }
1512 }
1513
1514 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n",
1515 __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
1516
1517 return (self->bulk_in_ep != 0) && (self->bulk_out_ep != 0);
1518}
1519
1520#ifdef IU_DUMP_CLASS_DESC
1521
1522
1523
1524
1525
1526
1527
1528static inline void irda_usb_dump_class_desc(struct irda_class_desc *desc)
1529{
1530
1531 printk("bLength=%x\n", desc->bLength);
1532 printk("bDescriptorType=%x\n", desc->bDescriptorType);
1533 printk("bcdSpecRevision=%x\n", le16_to_cpu(desc->bcdSpecRevision));
1534 printk("bmDataSize=%x\n", desc->bmDataSize);
1535 printk("bmWindowSize=%x\n", desc->bmWindowSize);
1536 printk("bmMinTurnaroundTime=%d\n", desc->bmMinTurnaroundTime);
1537 printk("wBaudRate=%x\n", le16_to_cpu(desc->wBaudRate));
1538 printk("bmAdditionalBOFs=%x\n", desc->bmAdditionalBOFs);
1539 printk("bIrdaRateSniff=%x\n", desc->bIrdaRateSniff);
1540 printk("bMaxUnicastList=%x\n", desc->bMaxUnicastList);
1541}
1542#endif
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf)
1555{
1556 struct usb_device *dev = interface_to_usbdev (intf);
1557 struct irda_class_desc *desc;
1558 int ret;
1559
1560 desc = kzalloc(sizeof(*desc), GFP_KERNEL);
1561 if (!desc)
1562 return NULL;
1563
1564
1565
1566
1567
1568
1569
1570
1571 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0),
1572 IU_REQ_GET_CLASS_DESC,
1573 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
1574 0, intf->altsetting->desc.bInterfaceNumber, desc,
1575 sizeof(*desc), 500);
1576
1577 IRDA_DEBUG(1, "%s(), ret=%d\n", __func__, ret);
1578 if (ret < sizeof(*desc)) {
1579 IRDA_WARNING("usb-irda: class_descriptor read %s (%d)\n",
1580 (ret<0) ? "failed" : "too short", ret);
1581 }
1582 else if (desc->bDescriptorType != USB_DT_IRDA) {
1583 IRDA_WARNING("usb-irda: bad class_descriptor type\n");
1584 }
1585 else {
1586#ifdef IU_DUMP_CLASS_DESC
1587 irda_usb_dump_class_desc(desc);
1588#endif
1589
1590 return desc;
1591 }
1592 kfree(desc);
1593 return NULL;
1594}
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610static int irda_usb_probe(struct usb_interface *intf,
1611 const struct usb_device_id *id)
1612{
1613 struct net_device *net;
1614 struct usb_device *dev = interface_to_usbdev(intf);
1615 struct irda_usb_cb *self;
1616 struct usb_host_interface *interface;
1617 struct irda_class_desc *irda_desc;
1618 int ret = -ENOMEM;
1619 int i;
1620
1621
1622
1623
1624
1625
1626 IRDA_MESSAGE("IRDA-USB found at address %d, Vendor: %x, Product: %x\n",
1627 dev->devnum, le16_to_cpu(dev->descriptor.idVendor),
1628 le16_to_cpu(dev->descriptor.idProduct));
1629
1630 net = alloc_irdadev(sizeof(*self));
1631 if (!net)
1632 goto err_out;
1633
1634 SET_NETDEV_DEV(net, &intf->dev);
1635 self = netdev_priv(net);
1636 self->netdev = net;
1637 spin_lock_init(&self->lock);
1638 init_timer(&self->rx_defer_timer);
1639
1640 self->capability = id->driver_info;
1641 self->needspatch = ((self->capability & IUC_STIR421X) != 0);
1642
1643
1644 if (self->capability & IUC_STIR421X) {
1645 self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS;
1646 self->header_length = USB_IRDA_STIR421X_HEADER;
1647 } else {
1648 self->max_rx_urb = IU_MAX_RX_URBS;
1649 self->header_length = USB_IRDA_HEADER;
1650 }
1651
1652 self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *),
1653 GFP_KERNEL);
1654 if (!self->rx_urb)
1655 goto err_free_net;
1656
1657 for (i = 0; i < self->max_rx_urb; i++) {
1658 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
1659 if (!self->rx_urb[i]) {
1660 goto err_out_1;
1661 }
1662 }
1663 self->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
1664 if (!self->tx_urb) {
1665 goto err_out_1;
1666 }
1667 self->speed_urb = usb_alloc_urb(0, GFP_KERNEL);
1668 if (!self->speed_urb) {
1669 goto err_out_2;
1670 }
1671
1672
1673 if (usb_reset_configuration (dev) < 0) {
1674 dev_err(&intf->dev, "reset_configuration failed\n");
1675 ret = -EIO;
1676 goto err_out_3;
1677 }
1678
1679
1680
1681
1682
1683 ret = usb_set_interface(dev, intf->altsetting->desc.bInterfaceNumber, 0);
1684 IRDA_DEBUG(1, "usb-irda: set interface %d result %d\n", intf->altsetting->desc.bInterfaceNumber, ret);
1685 switch (ret) {
1686 case 0:
1687 break;
1688 case -EPIPE:
1689
1690
1691
1692 IRDA_DEBUG(0, "%s(), Received -EPIPE, ignoring...\n", __func__);
1693 break;
1694 default:
1695 IRDA_DEBUG(0, "%s(), Unknown error %d\n", __func__, ret);
1696 ret = -EIO;
1697 goto err_out_3;
1698 }
1699
1700
1701 interface = intf->cur_altsetting;
1702 if(!irda_usb_parse_endpoints(self, interface->endpoint,
1703 interface->desc.bNumEndpoints)) {
1704 IRDA_ERROR("%s(), Bogus endpoints...\n", __func__);
1705 ret = -EIO;
1706 goto err_out_3;
1707 }
1708
1709 self->usbdev = dev;
1710
1711
1712 irda_desc = irda_usb_find_class_desc(intf);
1713 ret = -ENODEV;
1714 if (!irda_desc)
1715 goto err_out_3;
1716
1717 if (self->needspatch) {
1718 ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
1719 0x02, 0x40, 0, 0, NULL, 0, 500);
1720 if (ret < 0) {
1721 IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
1722 goto err_out_3;
1723 } else {
1724 mdelay(10);
1725 }
1726 }
1727
1728 self->irda_desc = irda_desc;
1729 self->present = 1;
1730 self->netopen = 0;
1731 self->usbintf = intf;
1732
1733
1734
1735
1736
1737 self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
1738 if (!self->speed_buff)
1739 goto err_out_3;
1740
1741 self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length,
1742 GFP_KERNEL);
1743 if (!self->tx_buff)
1744 goto err_out_4;
1745
1746 ret = irda_usb_open(self);
1747 if (ret)
1748 goto err_out_5;
1749
1750 IRDA_MESSAGE("IrDA: Registered device %s\n", net->name);
1751 usb_set_intfdata(intf, self);
1752
1753 if (self->needspatch) {
1754
1755 ret = stir421x_patch_device(self);
1756 self->needspatch = (ret < 0);
1757 if (self->needspatch) {
1758 IRDA_ERROR("STIR421X: Couldn't upload patch\n");
1759 goto err_out_6;
1760 }
1761
1762
1763 irda_desc = irda_usb_find_class_desc (self->usbintf);
1764 if (!irda_desc) {
1765 ret = -ENODEV;
1766 goto err_out_6;
1767 }
1768 kfree(self->irda_desc);
1769 self->irda_desc = irda_desc;
1770 irda_usb_init_qos(self);
1771 }
1772
1773 return 0;
1774err_out_6:
1775 unregister_netdev(self->netdev);
1776err_out_5:
1777 kfree(self->tx_buff);
1778err_out_4:
1779 kfree(self->speed_buff);
1780err_out_3:
1781
1782 usb_free_urb(self->speed_urb);
1783err_out_2:
1784 usb_free_urb(self->tx_urb);
1785err_out_1:
1786 for (i = 0; i < self->max_rx_urb; i++)
1787 usb_free_urb(self->rx_urb[i]);
1788 kfree(self->rx_urb);
1789err_free_net:
1790 free_netdev(net);
1791err_out:
1792 return ret;
1793}
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807static void irda_usb_disconnect(struct usb_interface *intf)
1808{
1809 unsigned long flags;
1810 struct irda_usb_cb *self = usb_get_intfdata(intf);
1811 int i;
1812
1813 IRDA_DEBUG(1, "%s()\n", __func__);
1814
1815 usb_set_intfdata(intf, NULL);
1816 if (!self)
1817 return;
1818
1819
1820 spin_lock_irqsave(&self->lock, flags);
1821
1822
1823
1824 self->present = 0;
1825
1826
1827 del_timer(&self->rx_defer_timer);
1828
1829
1830
1831 spin_unlock_irqrestore(&self->lock, flags);
1832
1833
1834 if((self->netopen) || (self->irlap)) {
1835
1836
1837 netif_stop_queue(self->netdev);
1838
1839 for (i = 0; i < self->max_rx_urb; i++)
1840 usb_kill_urb(self->rx_urb[i]);
1841
1842
1843 usb_kill_urb(self->tx_urb);
1844 usb_kill_urb(self->speed_urb);
1845 }
1846
1847
1848 irda_usb_close(self);
1849
1850 self->usbdev = NULL;
1851 self->usbintf = NULL;
1852
1853
1854 for (i = 0; i < self->max_rx_urb; i++)
1855 usb_free_urb(self->rx_urb[i]);
1856 kfree(self->rx_urb);
1857
1858 usb_free_urb(self->tx_urb);
1859 usb_free_urb(self->speed_urb);
1860
1861
1862 free_netdev(self->netdev);
1863 IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__);
1864}
1865
1866#ifdef CONFIG_PM
1867
1868static int irda_usb_suspend(struct usb_interface *intf, pm_message_t message)
1869{
1870 struct irda_usb_cb *self = usb_get_intfdata(intf);
1871 int i;
1872
1873 netif_device_detach(self->netdev);
1874
1875 if (self->tx_urb != NULL)
1876 usb_kill_urb(self->tx_urb);
1877 if (self->speed_urb != NULL)
1878 usb_kill_urb(self->speed_urb);
1879 for (i = 0; i < self->max_rx_urb; i++) {
1880 if (self->rx_urb[i] != NULL)
1881 usb_kill_urb(self->rx_urb[i]);
1882 }
1883 return 0;
1884}
1885
1886
1887static int irda_usb_resume(struct usb_interface *intf)
1888{
1889 struct irda_usb_cb *self = usb_get_intfdata(intf);
1890 int i;
1891
1892 for (i = 0; i < self->max_rx_urb; i++) {
1893 if (self->rx_urb[i] != NULL)
1894 usb_submit_urb(self->rx_urb[i], GFP_KERNEL);
1895 }
1896
1897 netif_device_attach(self->netdev);
1898 return 0;
1899}
1900#endif
1901
1902
1903
1904
1905
1906static struct usb_driver irda_driver = {
1907 .name = "irda-usb",
1908 .probe = irda_usb_probe,
1909 .disconnect = irda_usb_disconnect,
1910 .id_table = dongles,
1911#ifdef CONFIG_PM
1912 .suspend = irda_usb_suspend,
1913 .resume = irda_usb_resume,
1914#endif
1915};
1916
1917module_usb_driver(irda_driver);
1918
1919
1920
1921
1922module_param(qos_mtt_bits, int, 0);
1923MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
1924MODULE_AUTHOR("Roman Weissgaerber <weissg@vienna.at>, Dag Brattli <dag@brattli.net>, Jean Tourrilhes <jt@hpl.hp.com> and Nick Fedchik <nick@fedchik.org.ua>");
1925MODULE_DESCRIPTION("IrDA-USB Dongle Driver");
1926MODULE_LICENSE("GPL");
1927