Skip to content

Commit

Permalink
V4L/DVB: IR: Allow not to compile keymaps in
Browse files Browse the repository at this point in the history
Currently, ir device registration fails if keymap requested by driver is not found.
Fix that by always compiling in the empty keymap, and using it as a failback.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Maxim Levitsky authored and Mauro Carvalho Chehab committed Aug 9, 2010
1 parent 86ff071 commit b378f43
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 48 deletions.
3 changes: 2 additions & 1 deletion drivers/media/IR/ir-core-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
void ir_raw_init(void);


int ir_rcmap_init(void);
void ir_rcmap_cleanup(void);
/*
* Decoder initialization code
*
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/IR/ir-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,15 @@ static int __init ir_core_init(void)

/* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
ir_rcmap_init();

return 0;
}

static void __exit ir_core_exit(void)
{
class_unregister(&ir_input_class);
ir_rcmap_cleanup();
}

module_init(ir_core_init);
Expand Down
1 change: 0 additions & 1 deletion drivers/media/IR/keymaps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-dm1105-nec.o \
rc-dntv-live-dvb-t.o \
rc-dntv-live-dvbt-pro.o \
rc-empty.o \
rc-em-terratec.o \
rc-encore-enltv2.o \
rc-encore-enltv.o \
Expand Down
44 changes: 0 additions & 44 deletions drivers/media/IR/keymaps/rc-empty.c

This file was deleted.

23 changes: 23 additions & 0 deletions drivers/media/IR/rc-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ void ir_unregister_map(struct rc_keymap *map)
}
EXPORT_SYMBOL_GPL(ir_unregister_map);


static struct ir_scancode empty[] = {
{ 0x2a, KEY_COFFEE },
};

static struct rc_keymap empty_map = {
.map = {
.scan = empty,
.size = ARRAY_SIZE(empty),
.ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */
.name = RC_MAP_EMPTY,
}
};

int ir_rcmap_init(void)
{
return ir_register_map(&empty_map);
}

void ir_rcmap_cleanup(void)
{
ir_unregister_map(&empty_map);
}
8 changes: 6 additions & 2 deletions include/media/ir-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ static inline int ir_input_register(struct input_dev *dev,
return -EINVAL;

ir_codes = get_rc_map(map_name);
if (!ir_codes)
return -EINVAL;
if (!ir_codes) {
ir_codes = get_rc_map(RC_MAP_EMPTY);

if (!ir_codes)
return -EINVAL;
}

rc = __ir_input_register(dev, ir_codes, props, driver_name);
if (rc < 0)
Expand Down

0 comments on commit b378f43

Please sign in to comment.