diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-11-27 20:40:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:42:19 -0500 |
commit | 8573b74af25c279de3e309beddcba984bee9ec15 (patch) | |
tree | 62635afe2df0727b5eed544f43d9e6b5c2aabdcb /drivers/media/common | |
parent | ef53a1159dfcdc1fecf5adb5b8d26803f194c09b (diff) |
V4L/DVB (13533): ir: use dynamic tables, instead of static ones
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/ir-functions.c | 32 | ||||
-rw-r--r-- | drivers/media/common/ir-keytable.c | 2 |
2 files changed, 6 insertions, 28 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); | |||
42 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) | 42 | static 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) | |||
57 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 57 | void 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) | |||
97 | EXPORT_SYMBOL_GPL(ir_input_nokey); | 79 | EXPORT_SYMBOL_GPL(ir_input_nokey); |
98 | 80 | ||
99 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | 81 | void 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 */ |
diff --git a/drivers/media/common/ir-keytable.c b/drivers/media/common/ir-keytable.c index 2de7caeef437..65e352389b2d 100644 --- a/drivers/media/common/ir-keytable.c +++ b/drivers/media/common/ir-keytable.c | |||
@@ -118,7 +118,6 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) | |||
118 | 118 | ||
119 | return KEY_UNKNOWN; | 119 | return KEY_UNKNOWN; |
120 | } | 120 | } |
121 | EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); | ||
122 | 121 | ||
123 | /** | 122 | /** |
124 | * ir_set_keycode_table() - sets the IR keycode table and add the handlers | 123 | * ir_set_keycode_table() - sets the IR keycode table and add the handlers |
@@ -153,4 +152,3 @@ int ir_set_keycode_table(struct input_dev *input_dev, | |||
153 | 152 | ||
154 | return 0; | 153 | return 0; |
155 | } | 154 | } |
156 | EXPORT_SYMBOL_GPL(ir_set_keycode_table); | ||