diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-08-29 13:15:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:19:47 -0400 |
commit | 715a223323c8c8bcbe7739e20f6c619f7343b595 (patch) | |
tree | 0c7eddcdd3c778428fc936009af085940c0394bb /drivers/media/dvb | |
parent | 47f7f6fb7949b6546baf4b6f26bf0ca075d12759 (diff) |
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index c662fa65a339..2d099e271751 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -577,7 +577,7 @@ static irqreturn_t dm1105dvb_irq(int irq, void *dev_id) | |||
577 | int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) | 577 | int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) |
578 | { | 578 | { |
579 | struct input_dev *input_dev; | 579 | struct input_dev *input_dev; |
580 | IR_KEYTAB_TYPE *ir_codes = ir_codes_dm1105_nec; | 580 | struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; |
581 | int ir_type = IR_TYPE_OTHER; | 581 | int ir_type = IR_TYPE_OTHER; |
582 | int err = -ENOMEM; | 582 | int err = -ENOMEM; |
583 | 583 | ||
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 371a71616810..b5c681372b6c 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -225,7 +225,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
225 | case 0x1012: | 225 | case 0x1012: |
226 | /* The hauppauge keymap is a superset of these remotes */ | 226 | /* The hauppauge keymap is a superset of these remotes */ |
227 | ir_input_init(input_dev, &budget_ci->ir.state, | 227 | ir_input_init(input_dev, &budget_ci->ir.state, |
228 | IR_TYPE_RC5, ir_codes_hauppauge_new); | 228 | IR_TYPE_RC5, &ir_codes_hauppauge_new_table); |
229 | 229 | ||
230 | if (rc5_device < 0) | 230 | if (rc5_device < 0) |
231 | budget_ci->ir.rc5_device = 0x1f; | 231 | budget_ci->ir.rc5_device = 0x1f; |
@@ -237,7 +237,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
237 | case 0x101a: | 237 | case 0x101a: |
238 | /* for the Technotrend 1500 bundled remote */ | 238 | /* for the Technotrend 1500 bundled remote */ |
239 | ir_input_init(input_dev, &budget_ci->ir.state, | 239 | ir_input_init(input_dev, &budget_ci->ir.state, |
240 | IR_TYPE_RC5, ir_codes_tt_1500); | 240 | IR_TYPE_RC5, &ir_codes_tt_1500_table); |
241 | 241 | ||
242 | if (rc5_device < 0) | 242 | if (rc5_device < 0) |
243 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | 243 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; |
@@ -247,7 +247,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
247 | default: | 247 | default: |
248 | /* unknown remote */ | 248 | /* unknown remote */ |
249 | ir_input_init(input_dev, &budget_ci->ir.state, | 249 | ir_input_init(input_dev, &budget_ci->ir.state, |
250 | IR_TYPE_RC5, ir_codes_budget_ci_old); | 250 | IR_TYPE_RC5, &ir_codes_budget_ci_old_table); |
251 | 251 | ||
252 | if (rc5_device < 0) | 252 | if (rc5_device < 0) |
253 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | 253 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; |