summaryrefslogtreecommitdiffstats
path: root/drivers/media/IR/ir-keytable.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-04-04 14:06:55 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 12:56:58 -0300
commit9dfe4e8339499bfe8e9a362fefc290b4cb9c3803 (patch)
treea42ab74108d03f8009f01e2fc896df15638dfc06 /drivers/media/IR/ir-keytable.c
parent4f9256b496677adf799342cee7d406dd46e566d9 (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.c25
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,
{
unsigned int i;
int old_keycode = KEY_RESERVED;
+ struct ir_input_dev *ir_dev = input_get_drvdata(dev);
+
+ /*
+ * Unfortunately, some hardware-based IR decoders don't provide
+ * all bits for the complete IR code. In general, they provide only
+ * the command part of the IR code. Yet, as it is possible to replace
+ * the provided IR with another one, it is needed to allow loading
+ * IR tables from other remotes. So,
+ */
+ if (ir_dev->props && ir_dev->props->scanmask) {
+ scancode &= ir_dev->props->scanmask;
+ }
/* First check if we already have a mapping for this ir command */
for (i = 0; i < rc_tab->len; i++) {
@@ -448,6 +460,13 @@ int __ir_input_register(struct input_dev *input_dev,
sizeof(struct ir_scancode));
ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL);
ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode);
+ if (props) {
+ ir_dev->props = props;
+ if (props->open)
+ input_dev->open = ir_open;
+ if (props->close)
+ input_dev->close = ir_close;
+ }
if (!ir_dev->rc_tab.scan) {
rc = -ENOMEM;
@@ -465,12 +484,6 @@ int __ir_input_register(struct input_dev *input_dev,
goto out_table;
}
- ir_dev->props = props;
- if (props && props->open)
- input_dev->open = ir_open;
- if (props && props->close)
- input_dev->close = ir_close;
-
rc = ir_register_class(input_dev);
if (rc < 0)
goto out_table;