]>
Commit | Line | Data |
---|---|---|
26ff6313 SY |
1 | /* |
2 | * IguanaWorks USB IR Transceiver support | |
3 | * | |
4 | * Copyright (C) 2012 Sean Young <sean@mess.org> | |
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 | ||
21 | #include <linux/device.h> | |
22 | #include <linux/kernel.h> | |
23 | #include <linux/module.h> | |
24 | #include <linux/usb.h> | |
25 | #include <linux/usb/input.h> | |
26 | #include <linux/slab.h> | |
27 | #include <linux/completion.h> | |
28 | #include <media/rc-core.h> | |
29 | ||
30 | #define DRIVER_NAME "iguanair" | |
31 | ||
32 | struct iguanair { | |
33 | struct rc_dev *rc; | |
34 | ||
35 | struct device *dev; | |
36 | struct usb_device *udev; | |
37 | ||
e99a7cfe | 38 | int pipe_out; |
0797b480 | 39 | uint16_t version; |
26ff6313 | 40 | uint8_t bufsize; |
26ff6313 SY |
41 | |
42 | struct mutex lock; | |
43 | ||
44 | /* receiver support */ | |
45 | bool receiver_on; | |
46 | dma_addr_t dma_in; | |
47 | uint8_t *buf_in; | |
48 | struct urb *urb_in; | |
49 | struct completion completion; | |
50 | ||
51 | /* transmit support */ | |
52 | bool tx_overflow; | |
53 | uint32_t carrier; | |
54 | uint8_t cycle_overhead; | |
55 | uint8_t channels; | |
56 | uint8_t busy4; | |
57 | uint8_t busy7; | |
58 | ||
59 | char name[64]; | |
60 | char phys[64]; | |
61 | }; | |
62 | ||
63 | #define CMD_GET_VERSION 0x01 | |
64 | #define CMD_GET_BUFSIZE 0x11 | |
65 | #define CMD_GET_FEATURES 0x10 | |
66 | #define CMD_SEND 0x15 | |
67 | #define CMD_EXECUTE 0x1f | |
68 | #define CMD_RX_OVERFLOW 0x31 | |
69 | #define CMD_TX_OVERFLOW 0x32 | |
70 | #define CMD_RECEIVER_ON 0x12 | |
71 | #define CMD_RECEIVER_OFF 0x14 | |
72 | ||
73 | #define DIR_IN 0xdc | |
74 | #define DIR_OUT 0xcd | |
75 | ||
76 | #define MAX_PACKET_SIZE 8u | |
77 | #define TIMEOUT 1000 | |
78 | ||
79 | struct packet { | |
80 | uint16_t start; | |
81 | uint8_t direction; | |
82 | uint8_t cmd; | |
83 | }; | |
84 | ||
26ff6313 SY |
85 | struct send_packet { |
86 | struct packet header; | |
87 | uint8_t length; | |
88 | uint8_t channels; | |
89 | uint8_t busy7; | |
90 | uint8_t busy4; | |
91 | uint8_t payload[0]; | |
92 | }; | |
93 | ||
94 | static void process_ir_data(struct iguanair *ir, unsigned len) | |
95 | { | |
96 | if (len >= 4 && ir->buf_in[0] == 0 && ir->buf_in[1] == 0) { | |
97 | switch (ir->buf_in[3]) { | |
e99a7cfe SY |
98 | case CMD_GET_VERSION: |
99 | if (len == 6) { | |
0797b480 SY |
100 | ir->version = (ir->buf_in[5] << 8) | |
101 | ir->buf_in[4]; | |
e99a7cfe SY |
102 | complete(&ir->completion); |
103 | } | |
104 | break; | |
105 | case CMD_GET_BUFSIZE: | |
106 | if (len >= 5) { | |
107 | ir->bufsize = ir->buf_in[4]; | |
108 | complete(&ir->completion); | |
109 | } | |
110 | break; | |
111 | case CMD_GET_FEATURES: | |
112 | if (len > 5) { | |
0797b480 | 113 | ir->cycle_overhead = ir->buf_in[5]; |
e99a7cfe SY |
114 | complete(&ir->completion); |
115 | } | |
116 | break; | |
26ff6313 SY |
117 | case CMD_TX_OVERFLOW: |
118 | ir->tx_overflow = true; | |
119 | case CMD_RECEIVER_OFF: | |
120 | case CMD_RECEIVER_ON: | |
121 | case CMD_SEND: | |
122 | complete(&ir->completion); | |
123 | break; | |
124 | case CMD_RX_OVERFLOW: | |
125 | dev_warn(ir->dev, "receive overflow\n"); | |
126 | break; | |
127 | default: | |
128 | dev_warn(ir->dev, "control code %02x received\n", | |
129 | ir->buf_in[3]); | |
130 | break; | |
131 | } | |
132 | } else if (len >= 7) { | |
133 | DEFINE_IR_RAW_EVENT(rawir); | |
134 | unsigned i; | |
135 | ||
136 | init_ir_raw_event(&rawir); | |
137 | ||
138 | for (i = 0; i < 7; i++) { | |
139 | if (ir->buf_in[i] == 0x80) { | |
140 | rawir.pulse = false; | |
141 | rawir.duration = US_TO_NS(21845); | |
142 | } else { | |
143 | rawir.pulse = (ir->buf_in[i] & 0x80) == 0; | |
144 | rawir.duration = ((ir->buf_in[i] & 0x7f) + 1) * | |
145 | 21330; | |
146 | } | |
147 | ||
148 | ir_raw_event_store_with_filter(ir->rc, &rawir); | |
149 | } | |
150 | ||
151 | ir_raw_event_handle(ir->rc); | |
152 | } | |
153 | } | |
154 | ||
155 | static void iguanair_rx(struct urb *urb) | |
156 | { | |
157 | struct iguanair *ir; | |
7c0bd96b | 158 | int rc; |
26ff6313 SY |
159 | |
160 | if (!urb) | |
161 | return; | |
162 | ||
163 | ir = urb->context; | |
164 | if (!ir) { | |
165 | usb_unlink_urb(urb); | |
166 | return; | |
167 | } | |
168 | ||
169 | switch (urb->status) { | |
170 | case 0: | |
171 | process_ir_data(ir, urb->actual_length); | |
172 | break; | |
173 | case -ECONNRESET: | |
174 | case -ENOENT: | |
175 | case -ESHUTDOWN: | |
176 | usb_unlink_urb(urb); | |
177 | return; | |
178 | case -EPIPE: | |
179 | default: | |
180 | dev_dbg(ir->dev, "Error: urb status = %d\n", urb->status); | |
181 | break; | |
182 | } | |
183 | ||
7c0bd96b SY |
184 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
185 | if (rc && rc != -ENODEV) | |
186 | dev_warn(ir->dev, "failed to resubmit urb: %d\n", rc); | |
26ff6313 SY |
187 | } |
188 | ||
e99a7cfe | 189 | static int iguanair_send(struct iguanair *ir, void *data, unsigned size) |
26ff6313 | 190 | { |
26ff6313 SY |
191 | int rc, transferred; |
192 | ||
e99a7cfe | 193 | INIT_COMPLETION(ir->completion); |
26ff6313 | 194 | |
e99a7cfe SY |
195 | rc = usb_interrupt_msg(ir->udev, ir->pipe_out, data, size, |
196 | &transferred, TIMEOUT); | |
197 | if (rc) | |
198 | return rc; | |
26ff6313 | 199 | |
e99a7cfe SY |
200 | if (transferred != size) |
201 | return -EIO; | |
26ff6313 | 202 | |
e99a7cfe SY |
203 | if (wait_for_completion_timeout(&ir->completion, TIMEOUT) == 0) |
204 | return -ETIMEDOUT; | |
26ff6313 SY |
205 | |
206 | return rc; | |
207 | } | |
208 | ||
209 | static int iguanair_get_features(struct iguanair *ir) | |
210 | { | |
211 | struct packet packet; | |
e99a7cfe | 212 | int rc; |
26ff6313 SY |
213 | |
214 | packet.start = 0; | |
215 | packet.direction = DIR_OUT; | |
216 | packet.cmd = CMD_GET_VERSION; | |
217 | ||
e99a7cfe | 218 | rc = iguanair_send(ir, &packet, sizeof(packet)); |
26ff6313 SY |
219 | if (rc) { |
220 | dev_info(ir->dev, "failed to get version\n"); | |
221 | goto out; | |
222 | } | |
223 | ||
0797b480 SY |
224 | if (ir->version < 0x205) { |
225 | dev_err(ir->dev, "firmware 0x%04x is too old\n", ir->version); | |
226 | rc = -ENODEV; | |
227 | goto out; | |
228 | } | |
229 | ||
26ff6313 SY |
230 | ir->bufsize = 150; |
231 | ir->cycle_overhead = 65; | |
232 | ||
233 | packet.cmd = CMD_GET_BUFSIZE; | |
234 | ||
e99a7cfe | 235 | rc = iguanair_send(ir, &packet, sizeof(packet)); |
26ff6313 SY |
236 | if (rc) { |
237 | dev_info(ir->dev, "failed to get buffer size\n"); | |
238 | goto out; | |
239 | } | |
240 | ||
26ff6313 SY |
241 | packet.cmd = CMD_GET_FEATURES; |
242 | ||
e99a7cfe | 243 | rc = iguanair_send(ir, &packet, sizeof(packet)); |
26ff6313 SY |
244 | if (rc) { |
245 | dev_info(ir->dev, "failed to get features\n"); | |
246 | goto out; | |
247 | } | |
248 | ||
26ff6313 SY |
249 | out: |
250 | return rc; | |
251 | } | |
252 | ||
253 | static int iguanair_receiver(struct iguanair *ir, bool enable) | |
254 | { | |
255 | struct packet packet = { 0, DIR_OUT, enable ? | |
256 | CMD_RECEIVER_ON : CMD_RECEIVER_OFF }; | |
26ff6313 | 257 | |
e99a7cfe | 258 | return iguanair_send(ir, &packet, sizeof(packet)); |
26ff6313 SY |
259 | } |
260 | ||
261 | /* | |
262 | * The iguana ir creates the carrier by busy spinning after each pulse or | |
263 | * space. This is counted in CPU cycles, with the CPU running at 24MHz. It is | |
264 | * broken down into 7-cycles and 4-cyles delays, with a preference for | |
265 | * 4-cycle delays. | |
266 | */ | |
267 | static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier) | |
268 | { | |
269 | struct iguanair *ir = dev->priv; | |
270 | ||
271 | if (carrier < 25000 || carrier > 150000) | |
272 | return -EINVAL; | |
273 | ||
274 | mutex_lock(&ir->lock); | |
275 | ||
276 | if (carrier != ir->carrier) { | |
277 | uint32_t cycles, fours, sevens; | |
278 | ||
279 | ir->carrier = carrier; | |
280 | ||
281 | cycles = DIV_ROUND_CLOSEST(24000000, carrier * 2) - | |
282 | ir->cycle_overhead; | |
283 | ||
284 | /* make up the the remainer of 4-cycle blocks */ | |
285 | switch (cycles & 3) { | |
286 | case 0: | |
287 | sevens = 0; | |
288 | break; | |
289 | case 1: | |
290 | sevens = 3; | |
291 | break; | |
292 | case 2: | |
293 | sevens = 2; | |
294 | break; | |
295 | case 3: | |
296 | sevens = 1; | |
297 | break; | |
298 | } | |
299 | ||
300 | fours = (cycles - sevens * 7) / 4; | |
301 | ||
302 | /* magic happens here */ | |
303 | ir->busy7 = (4 - sevens) * 2; | |
304 | ir->busy4 = 110 - fours; | |
305 | } | |
306 | ||
307 | mutex_unlock(&ir->lock); | |
308 | ||
309 | return carrier; | |
310 | } | |
311 | ||
312 | static int iguanair_set_tx_mask(struct rc_dev *dev, uint32_t mask) | |
313 | { | |
314 | struct iguanair *ir = dev->priv; | |
315 | ||
316 | if (mask > 15) | |
317 | return 4; | |
318 | ||
319 | mutex_lock(&ir->lock); | |
320 | ir->channels = mask; | |
321 | mutex_unlock(&ir->lock); | |
322 | ||
323 | return 0; | |
324 | } | |
325 | ||
326 | static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count) | |
327 | { | |
328 | struct iguanair *ir = dev->priv; | |
329 | uint8_t space, *payload; | |
884bfd08 | 330 | unsigned i, size, rc, bytes; |
26ff6313 SY |
331 | struct send_packet *packet; |
332 | ||
333 | mutex_lock(&ir->lock); | |
334 | ||
335 | /* convert from us to carrier periods */ | |
336 | for (i = size = 0; i < count; i++) { | |
337 | txbuf[i] = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000); | |
884bfd08 SY |
338 | bytes = (txbuf[i] + 126) / 127; |
339 | if (size + bytes > ir->bufsize) { | |
340 | count = i; | |
341 | break; | |
342 | } | |
343 | size += bytes; | |
26ff6313 SY |
344 | } |
345 | ||
884bfd08 SY |
346 | if (count == 0) { |
347 | rc = -EINVAL; | |
26ff6313 SY |
348 | goto out; |
349 | } | |
350 | ||
884bfd08 SY |
351 | packet = kmalloc(sizeof(*packet) + size, GFP_KERNEL); |
352 | if (!packet) { | |
353 | rc = -ENOMEM; | |
26ff6313 SY |
354 | goto out; |
355 | } | |
356 | ||
357 | packet->header.start = 0; | |
358 | packet->header.direction = DIR_OUT; | |
359 | packet->header.cmd = CMD_SEND; | |
360 | packet->length = size; | |
361 | packet->channels = ir->channels << 4; | |
362 | packet->busy7 = ir->busy7; | |
363 | packet->busy4 = ir->busy4; | |
364 | ||
365 | space = 0; | |
366 | payload = packet->payload; | |
367 | ||
368 | for (i = 0; i < count; i++) { | |
369 | unsigned periods = txbuf[i]; | |
370 | ||
371 | while (periods > 127) { | |
372 | *payload++ = 127 | space; | |
373 | periods -= 127; | |
374 | } | |
375 | ||
376 | *payload++ = periods | space; | |
377 | space ^= 0x80; | |
378 | } | |
379 | ||
380 | if (ir->receiver_on) { | |
381 | rc = iguanair_receiver(ir, false); | |
382 | if (rc) { | |
383 | dev_warn(ir->dev, "disable receiver before transmit failed\n"); | |
884bfd08 | 384 | goto out_kfree; |
26ff6313 SY |
385 | } |
386 | } | |
387 | ||
388 | ir->tx_overflow = false; | |
389 | ||
e99a7cfe | 390 | rc = iguanair_send(ir, packet, size + 8); |
26ff6313 | 391 | |
e99a7cfe SY |
392 | if (rc == 0 && ir->tx_overflow) |
393 | rc = -EOVERFLOW; | |
26ff6313 SY |
394 | |
395 | if (ir->receiver_on) { | |
396 | if (iguanair_receiver(ir, true)) | |
397 | dev_warn(ir->dev, "re-enable receiver after transmit failed\n"); | |
398 | } | |
399 | ||
884bfd08 SY |
400 | out_kfree: |
401 | kfree(packet); | |
26ff6313 SY |
402 | out: |
403 | mutex_unlock(&ir->lock); | |
26ff6313 | 404 | |
884bfd08 | 405 | return rc ? rc : count; |
26ff6313 SY |
406 | } |
407 | ||
408 | static int iguanair_open(struct rc_dev *rdev) | |
409 | { | |
410 | struct iguanair *ir = rdev->priv; | |
411 | int rc; | |
412 | ||
413 | mutex_lock(&ir->lock); | |
414 | ||
26ff6313 SY |
415 | BUG_ON(ir->receiver_on); |
416 | ||
417 | rc = iguanair_receiver(ir, true); | |
418 | if (rc == 0) | |
419 | ir->receiver_on = true; | |
420 | ||
421 | mutex_unlock(&ir->lock); | |
422 | ||
423 | return rc; | |
424 | } | |
425 | ||
426 | static void iguanair_close(struct rc_dev *rdev) | |
427 | { | |
428 | struct iguanair *ir = rdev->priv; | |
429 | int rc; | |
430 | ||
431 | mutex_lock(&ir->lock); | |
432 | ||
433 | rc = iguanair_receiver(ir, false); | |
434 | ir->receiver_on = false; | |
7c0bd96b | 435 | if (rc && rc != -ENODEV) |
26ff6313 SY |
436 | dev_warn(ir->dev, "failed to disable receiver: %d\n", rc); |
437 | ||
26ff6313 SY |
438 | mutex_unlock(&ir->lock); |
439 | } | |
440 | ||
441 | static int __devinit iguanair_probe(struct usb_interface *intf, | |
442 | const struct usb_device_id *id) | |
443 | { | |
444 | struct usb_device *udev = interface_to_usbdev(intf); | |
445 | struct iguanair *ir; | |
446 | struct rc_dev *rc; | |
e99a7cfe | 447 | int ret, pipein; |
26ff6313 SY |
448 | struct usb_host_interface *idesc; |
449 | ||
450 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); | |
451 | rc = rc_allocate_device(); | |
452 | if (!ir || !rc) { | |
884bfd08 | 453 | ret = -ENOMEM; |
26ff6313 SY |
454 | goto out; |
455 | } | |
456 | ||
e99a7cfe | 457 | ir->buf_in = usb_alloc_coherent(udev, MAX_PACKET_SIZE, GFP_KERNEL, |
26ff6313 SY |
458 | &ir->dma_in); |
459 | ir->urb_in = usb_alloc_urb(0, GFP_KERNEL); | |
460 | ||
461 | if (!ir->buf_in || !ir->urb_in) { | |
884bfd08 | 462 | ret = -ENOMEM; |
26ff6313 SY |
463 | goto out; |
464 | } | |
465 | ||
466 | idesc = intf->altsetting; | |
467 | ||
468 | if (idesc->desc.bNumEndpoints < 2) { | |
469 | ret = -ENODEV; | |
470 | goto out; | |
471 | } | |
472 | ||
473 | ir->rc = rc; | |
474 | ir->dev = &intf->dev; | |
475 | ir->udev = udev; | |
26ff6313 SY |
476 | ir->pipe_out = usb_sndintpipe(udev, |
477 | idesc->endpoint[1].desc.bEndpointAddress); | |
478 | mutex_init(&ir->lock); | |
479 | init_completion(&ir->completion); | |
480 | ||
e99a7cfe SY |
481 | pipein = usb_rcvintpipe(udev, idesc->endpoint[0].desc.bEndpointAddress); |
482 | usb_fill_int_urb(ir->urb_in, udev, pipein, ir->buf_in, | |
26ff6313 SY |
483 | MAX_PACKET_SIZE, iguanair_rx, ir, |
484 | idesc->endpoint[0].desc.bInterval); | |
485 | ir->urb_in->transfer_dma = ir->dma_in; | |
486 | ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | |
487 | ||
e99a7cfe SY |
488 | ret = usb_submit_urb(ir->urb_in, GFP_KERNEL); |
489 | if (ret) { | |
490 | dev_warn(&intf->dev, "failed to submit urb: %d\n", ret); | |
491 | goto out; | |
492 | } | |
493 | ||
494 | ret = iguanair_get_features(ir); | |
495 | if (ret) | |
496 | goto out2; | |
497 | ||
26ff6313 | 498 | snprintf(ir->name, sizeof(ir->name), |
0797b480 | 499 | "IguanaWorks USB IR Transceiver version 0x%04x", ir->version); |
26ff6313 SY |
500 | |
501 | usb_make_path(ir->udev, ir->phys, sizeof(ir->phys)); | |
502 | ||
503 | rc->input_name = ir->name; | |
504 | rc->input_phys = ir->phys; | |
505 | usb_to_input_id(ir->udev, &rc->input_id); | |
506 | rc->dev.parent = &intf->dev; | |
507 | rc->driver_type = RC_DRIVER_IR_RAW; | |
508 | rc->allowed_protos = RC_TYPE_ALL; | |
509 | rc->priv = ir; | |
510 | rc->open = iguanair_open; | |
511 | rc->close = iguanair_close; | |
512 | rc->s_tx_mask = iguanair_set_tx_mask; | |
513 | rc->s_tx_carrier = iguanair_set_tx_carrier; | |
514 | rc->tx_ir = iguanair_tx; | |
515 | rc->driver_name = DRIVER_NAME; | |
516 | rc->map_name = RC_MAP_EMPTY; | |
517 | ||
518 | iguanair_set_tx_carrier(rc, 38000); | |
519 | ||
520 | ret = rc_register_device(rc); | |
521 | if (ret < 0) { | |
522 | dev_err(&intf->dev, "failed to register rc device %d", ret); | |
e99a7cfe | 523 | goto out2; |
26ff6313 SY |
524 | } |
525 | ||
526 | usb_set_intfdata(intf, ir); | |
527 | ||
26ff6313 | 528 | return 0; |
e99a7cfe SY |
529 | out2: |
530 | usb_kill_urb(ir->urb_in); | |
26ff6313 SY |
531 | out: |
532 | if (ir) { | |
533 | usb_free_urb(ir->urb_in); | |
534 | usb_free_coherent(udev, MAX_PACKET_SIZE, ir->buf_in, | |
535 | ir->dma_in); | |
536 | } | |
537 | rc_free_device(rc); | |
538 | kfree(ir); | |
539 | return ret; | |
540 | } | |
541 | ||
542 | static void __devexit iguanair_disconnect(struct usb_interface *intf) | |
543 | { | |
544 | struct iguanair *ir = usb_get_intfdata(intf); | |
545 | ||
7c0bd96b | 546 | rc_unregister_device(ir->rc); |
26ff6313 | 547 | usb_set_intfdata(intf, NULL); |
26ff6313 SY |
548 | usb_kill_urb(ir->urb_in); |
549 | usb_free_urb(ir->urb_in); | |
550 | usb_free_coherent(ir->udev, MAX_PACKET_SIZE, ir->buf_in, ir->dma_in); | |
26ff6313 SY |
551 | kfree(ir); |
552 | } | |
553 | ||
554 | static int iguanair_suspend(struct usb_interface *intf, pm_message_t message) | |
555 | { | |
556 | struct iguanair *ir = usb_get_intfdata(intf); | |
557 | int rc = 0; | |
558 | ||
559 | mutex_lock(&ir->lock); | |
560 | ||
561 | if (ir->receiver_on) { | |
562 | rc = iguanair_receiver(ir, false); | |
563 | if (rc) | |
564 | dev_warn(ir->dev, "failed to disable receiver for suspend\n"); | |
565 | } | |
566 | ||
7c0bd96b SY |
567 | usb_kill_urb(ir->urb_in); |
568 | ||
26ff6313 SY |
569 | mutex_unlock(&ir->lock); |
570 | ||
571 | return rc; | |
572 | } | |
573 | ||
574 | static int iguanair_resume(struct usb_interface *intf) | |
575 | { | |
576 | struct iguanair *ir = usb_get_intfdata(intf); | |
577 | int rc = 0; | |
578 | ||
579 | mutex_lock(&ir->lock); | |
580 | ||
7c0bd96b SY |
581 | rc = usb_submit_urb(ir->urb_in, GFP_KERNEL); |
582 | if (rc) | |
583 | dev_warn(&intf->dev, "failed to submit urb: %d\n", rc); | |
584 | ||
26ff6313 SY |
585 | if (ir->receiver_on) { |
586 | rc = iguanair_receiver(ir, true); | |
587 | if (rc) | |
588 | dev_warn(ir->dev, "failed to enable receiver after resume\n"); | |
589 | } | |
590 | ||
591 | mutex_unlock(&ir->lock); | |
592 | ||
593 | return rc; | |
594 | } | |
595 | ||
596 | static const struct usb_device_id iguanair_table[] = { | |
597 | { USB_DEVICE(0x1781, 0x0938) }, | |
598 | { } | |
599 | }; | |
600 | ||
601 | static struct usb_driver iguanair_driver = { | |
602 | .name = DRIVER_NAME, | |
603 | .probe = iguanair_probe, | |
604 | .disconnect = __devexit_p(iguanair_disconnect), | |
605 | .suspend = iguanair_suspend, | |
606 | .resume = iguanair_resume, | |
607 | .reset_resume = iguanair_resume, | |
7c0bd96b SY |
608 | .id_table = iguanair_table, |
609 | .soft_unbind = 1 /* we want to disable receiver on unbind */ | |
26ff6313 SY |
610 | }; |
611 | ||
612 | module_usb_driver(iguanair_driver); | |
613 | ||
614 | MODULE_DESCRIPTION("IguanaWorks USB IR Transceiver"); | |
615 | MODULE_AUTHOR("Sean Young <sean@mess.org>"); | |
616 | MODULE_LICENSE("GPL"); | |
617 | MODULE_DEVICE_TABLE(usb, iguanair_table); | |
618 |