diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-04 13:06:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:56:58 -0400 |
commit | 9dfe4e8339499bfe8e9a362fefc290b4cb9c3803 (patch) | |
tree | a42ab74108d03f8009f01e2fc896df15638dfc06 /drivers/media/IR/ir-keytable.c | |
parent | 4f9256b496677adf799342cee7d406dd46e566d9 (diff) |
V4L/DVB: ir-core: Add support for badly-implemented hardware decoders
A few hardware Remote Controller decoders, even using a standard protocol,
aren't able to provide the entire scancode. Due to that, the capability
of using other IR's are limited on those hardware.
Adds a way to indicate to ir-core what are the bits that the hardware
provides, from a scancode, allowing the addition of a complete IR table
to the kernel and allowing a limited support for changing the Remote
Controller on those devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/ir-keytable.c')
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index a89456932f7c..af7400bc906f 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -89,6 +89,18 @@ static int ir_do_setkeycode(struct input_dev *dev, | |||
89 | { | 89 | { |
90 | unsigned int i; | 90 | unsigned int i; |
91 | int old_keycode = KEY_RESERVED; | 91 | int old_keycode = KEY_RESERVED; |
92 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | ||
93 | |||
94 | /* | ||
95 | * Unfortunately, some hardware-based IR decoders don't provide | ||
96 | * all bits for the complete IR code. In general, they provide only | ||
97 | * the command part of the IR code. Yet, as it is possible to replace | ||
98 | * the provided IR with another one, it is needed to allow loading | ||
99 | * IR tables from other remotes. So, | ||
100 | */ | ||
101 | if (ir_dev->props && ir_dev->props->scanmask) { | ||
102 | scancode &= ir_dev->props->scanmask; | ||
103 | } | ||
92 | 104 | ||
93 | /* First check if we already have a mapping for this ir command */ | 105 | /* First check if we already have a mapping for this ir command */ |
94 | for (i = 0; i < rc_tab->len; i++) { | 106 | for (i = 0; i < rc_tab->len; i++) { |
@@ -448,6 +460,13 @@ int __ir_input_register(struct input_dev *input_dev, | |||
448 | sizeof(struct ir_scancode)); | 460 | sizeof(struct ir_scancode)); |
449 | ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL); | 461 | ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL); |
450 | ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode); | 462 | ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode); |
463 | if (props) { | ||
464 | ir_dev->props = props; | ||
465 | if (props->open) | ||
466 | input_dev->open = ir_open; | ||
467 | if (props->close) | ||
468 | input_dev->close = ir_close; | ||
469 | } | ||
451 | 470 | ||
452 | if (!ir_dev->rc_tab.scan) { | 471 | if (!ir_dev->rc_tab.scan) { |
453 | rc = -ENOMEM; | 472 | rc = -ENOMEM; |
@@ -465,12 +484,6 @@ int __ir_input_register(struct input_dev *input_dev, | |||
465 | goto out_table; | 484 | goto out_table; |
466 | } | 485 | } |
467 | 486 | ||
468 | ir_dev->props = props; | ||
469 | if (props && props->open) | ||
470 | input_dev->open = ir_open; | ||
471 | if (props && props->close) | ||
472 | input_dev->close = ir_close; | ||
473 | |||
474 | rc = ir_register_class(input_dev); | 487 | rc = ir_register_class(input_dev); |
475 | if (rc < 0) | 488 | if (rc < 0) |
476 | goto out_table; | 489 | goto out_table; |