aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/iguanair.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2012-08-13 07:59:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-13 15:05:57 -0400
commit0797b4802b57ce88e9361c8d64b0980508370649 (patch)
tree095b41fa36a42b7b330139e9ab46b3fe663bcdc8 /drivers/media/rc/iguanair.c
parente99a7cfe93fd9b853d80e7dda8b86ecca71c22bb (diff)
[media] iguanair: ignore unsupported firmware versions
Firmware versions lower than 0x0205 use a different interface which is not supported. Also report the firmware version in the standard format. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/iguanair.c')
-rw-r--r--drivers/media/rc/iguanair.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index bdd526df0b7..58854004db8 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -36,8 +36,8 @@ struct iguanair {
36 struct usb_device *udev; 36 struct usb_device *udev;
37 37
38 int pipe_out; 38 int pipe_out;
39 uint16_t version;
39 uint8_t bufsize; 40 uint8_t bufsize;
40 uint8_t version[2];
41 41
42 struct mutex lock; 42 struct mutex lock;
43 43
@@ -97,8 +97,8 @@ static void process_ir_data(struct iguanair *ir, unsigned len)
97 switch (ir->buf_in[3]) { 97 switch (ir->buf_in[3]) {
98 case CMD_GET_VERSION: 98 case CMD_GET_VERSION:
99 if (len == 6) { 99 if (len == 6) {
100 ir->version[0] = ir->buf_in[4]; 100 ir->version = (ir->buf_in[5] << 8) |
101 ir->version[1] = ir->buf_in[5]; 101 ir->buf_in[4];
102 complete(&ir->completion); 102 complete(&ir->completion);
103 } 103 }
104 break; 104 break;
@@ -110,8 +110,7 @@ static void process_ir_data(struct iguanair *ir, unsigned len)
110 break; 110 break;
111 case CMD_GET_FEATURES: 111 case CMD_GET_FEATURES:
112 if (len > 5) { 112 if (len > 5) {
113 if (ir->version[0] >= 4) 113 ir->cycle_overhead = ir->buf_in[5];
114 ir->cycle_overhead = ir->buf_in[5];
115 complete(&ir->completion); 114 complete(&ir->completion);
116 } 115 }
117 break; 116 break;
@@ -219,6 +218,12 @@ static int iguanair_get_features(struct iguanair *ir)
219 goto out; 218 goto out;
220 } 219 }
221 220
221 if (ir->version < 0x205) {
222 dev_err(ir->dev, "firmware 0x%04x is too old\n", ir->version);
223 rc = -ENODEV;
224 goto out;
225 }
226
222 ir->bufsize = 150; 227 ir->bufsize = 150;
223 ir->cycle_overhead = 65; 228 ir->cycle_overhead = 65;
224 229
@@ -230,9 +235,6 @@ static int iguanair_get_features(struct iguanair *ir)
230 goto out; 235 goto out;
231 } 236 }
232 237
233 if (ir->version[0] == 0 || ir->version[1] == 0)
234 goto out;
235
236 packet.cmd = CMD_GET_FEATURES; 238 packet.cmd = CMD_GET_FEATURES;
237 239
238 rc = iguanair_send(ir, &packet, sizeof(packet)); 240 rc = iguanair_send(ir, &packet, sizeof(packet));
@@ -485,8 +487,7 @@ static int __devinit iguanair_probe(struct usb_interface *intf,
485 goto out2; 487 goto out2;
486 488
487 snprintf(ir->name, sizeof(ir->name), 489 snprintf(ir->name, sizeof(ir->name),
488 "IguanaWorks USB IR Transceiver version %d.%d", 490 "IguanaWorks USB IR Transceiver version 0x%04x", ir->version);
489 ir->version[0], ir->version[1]);
490 491
491 usb_make_path(ir->udev, ir->phys, sizeof(ir->phys)); 492 usb_make_path(ir->udev, ir->phys, sizeof(ir->phys));
492 493