V4L/DVB (13634): ir-core: allow passing IR device parameters to ir-core

Adds an structure to ir_input_register to contain IR device characteristics,
like supported protocols and a callback to handle protocol event changes.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
Mauro Carvalho Chehab 2009-12-14 00:16:55 -03:00
commit e93854da88
15 changed files with 39 additions and 26 deletions

View file

@ -35,7 +35,7 @@
struct ir_input_state {
/* configuration */
int ir_type;
enum ir_type ir_type;
/* key info */
u32 ir_key; /* ir scancode */
@ -84,7 +84,7 @@ struct card_ir {
/* Routines from ir-functions.c */
int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
int ir_type);
const enum ir_type ir_type);
void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
u32 ir_key);

View file

@ -23,10 +23,10 @@ extern int ir_core_debug;
enum ir_type {
IR_TYPE_UNKNOWN = 0,
IR_TYPE_RC5 = 1,
IR_TYPE_PD = 2, /* Pulse distance encoded IR */
IR_TYPE_NEC = 3,
IR_TYPE_OTHER = 99,
IR_TYPE_RC5 = 1L << 0, /* Philips RC5 protocol */
IR_TYPE_PD = 1L << 1, /* Pulse distance encoded IR */
IR_TYPE_NEC = 1L << 2,
IR_TYPE_OTHER = 1L << 63,
};
struct ir_scancode {
@ -41,12 +41,19 @@ struct ir_scancode_table {
spinlock_t lock;
};
struct ir_dev_props {
unsigned long allowed_protos;
void *priv;
int (*change_protocol)(void *priv, unsigned long protocol);
};
struct ir_input_dev {
struct input_dev *dev; /* Input device*/
struct ir_scancode_table rc_tab; /* scan/key table */
unsigned long devno; /* device number */
struct attribute_group attr; /* IR attributes */
struct device *class_dev; /* virtual class dev */
const struct ir_dev_props *props; /* Device properties */
};
/* Routines from ir-keytable.c */
@ -59,7 +66,8 @@ int ir_set_keycode_table(struct input_dev *input_dev,
int ir_roundup_tablesize(int n_elems);
int ir_input_register(struct input_dev *dev,
struct ir_scancode_table *ir_codes);
const struct ir_scancode_table *ir_codes,
const struct ir_dev_props *props);
void ir_input_unregister(struct input_dev *input_dev);
/* Routines from ir-sysfs.c */

View file

@ -36,7 +36,7 @@ enum ir_kbd_get_key_fn {
struct IR_i2c_init_data {
struct ir_scancode_table *ir_codes;
const char *name;
int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
enum ir_type type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
/*
* Specify either a function pointer or a value indicating one of
* ir_kbd_i2c's internal get_key functions