aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/ir-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/ir-functions.c')
-rw-r--r--drivers/media/common/ir-functions.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
index b111a0d9409b..29885c2893d2 100644
--- a/drivers/media/common/ir-functions.c
+++ b/drivers/media/common/ir-functions.c
@@ -42,8 +42,8 @@ module_param_named(debug, media_ir_debug, int, 0644);
42static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) 42static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
43{ 43{
44 if (KEY_RESERVED == ir->keycode) { 44 if (KEY_RESERVED == ir->keycode) {
45 printk(KERN_INFO "%s: unknown key: key=0x%02x raw=0x%02x down=%d\n", 45 printk(KERN_INFO "%s: unknown key: key=0x%02x down=%d\n",
46 dev->name,ir->ir_key,ir->ir_raw,ir->keypressed); 46 dev->name, ir->ir_key, ir->keypressed);
47 return; 47 return;
48 } 48 }
49 IR_dprintk(1,"%s: key event code=%d down=%d\n", 49 IR_dprintk(1,"%s: key event code=%d down=%d\n",
@@ -57,28 +57,10 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
57void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 57void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
58 int ir_type, struct ir_scancode_table *ir_codes) 58 int ir_type, struct ir_scancode_table *ir_codes)
59{ 59{
60 int i;
61
62 ir->ir_type = ir_type; 60 ir->ir_type = ir_type;
63 61
64 memset(ir->ir_codes, 0, sizeof(ir->ir_codes)); 62 ir_set_keycode_table(dev, ir_codes);
65
66 /*
67 * FIXME: This is a temporary workaround to use the new IR tables
68 * with the old approach. Later patches will replace this to a
69 * proper method
70 */
71
72 if (ir_codes)
73 for (i = 0; i < ir_codes->size; i++)
74 if (ir_codes->scan[i].scancode < IR_KEYTAB_SIZE)
75 ir->ir_codes[ir_codes->scan[i].scancode] = ir_codes->scan[i].keycode;
76 63
77 dev->keycode = ir->ir_codes;
78 dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
79 dev->keycodemax = IR_KEYTAB_SIZE;
80 for (i = 0; i < IR_KEYTAB_SIZE; i++)
81 set_bit(ir->ir_codes[i], dev->keybit);
82 clear_bit(0, dev->keybit); 64 clear_bit(0, dev->keybit);
83 65
84 set_bit(EV_KEY, dev->evbit); 66 set_bit(EV_KEY, dev->evbit);
@@ -97,9 +79,9 @@ void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
97EXPORT_SYMBOL_GPL(ir_input_nokey); 79EXPORT_SYMBOL_GPL(ir_input_nokey);
98 80
99void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 81void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
100 u32 ir_key, u32 ir_raw) 82 u32 ir_key)
101{ 83{
102 u32 keycode = IR_KEYCODE(ir->ir_codes, ir_key); 84 u32 keycode = ir_g_keycode_from_table(dev, ir_key);
103 85
104 if (ir->keypressed && ir->keycode != keycode) { 86 if (ir->keypressed && ir->keycode != keycode) {
105 ir->keypressed = 0; 87 ir->keypressed = 0;
@@ -107,7 +89,6 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
107 } 89 }
108 if (!ir->keypressed) { 90 if (!ir->keypressed) {
109 ir->ir_key = ir_key; 91 ir->ir_key = ir_key;
110 ir->ir_raw = ir_raw;
111 ir->keycode = keycode; 92 ir->keycode = keycode;
112 ir->keypressed = 1; 93 ir->keypressed = 1;
113 ir_input_key_event(dev,ir); 94 ir_input_key_event(dev,ir);
@@ -354,8 +335,7 @@ void ir_rc5_timer_end(unsigned long data)
354 IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr, 335 IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr,
355 toggle); 336 toggle);
356 ir_input_nokey(ir->dev, &ir->ir); 337 ir_input_nokey(ir->dev, &ir->ir);
357 ir_input_keydown(ir->dev, &ir->ir, instr, 338 ir_input_keydown(ir->dev, &ir->ir, instr);
358 instr);
359 } 339 }
360 340
361 /* Set/reset key-up timer */ 341 /* Set/reset key-up timer */