summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorDavid Härdeman2010-04-02 20:58:29 +0200
committerMauro Carvalho Chehab2010-05-19 17:56:54 +0200
commita374fef4437abd0a1ee27afe0cca7a55425c1c3c (patch)
tree652e36573ac29d360d7f59cfb64a160c08390a54 /include/media
parentV4L/DVB: ir-core: re-add some debug functions for keytable changes (diff)
downloadkernel-qcow2-linux-a374fef4437abd0a1ee27afe0cca7a55425c1c3c.tar.gz
kernel-qcow2-linux-a374fef4437abd0a1ee27afe0cca7a55425c1c3c.tar.xz
kernel-qcow2-linux-a374fef4437abd0a1ee27afe0cca7a55425c1c3c.zip
V4L/DVB: ir-core: improve keyup/keydown logic
Rewrites the keyup/keydown logic in drivers/media/IR/ir-keytable.c. All knowledge of keystates etc is now internal to ir-keytable.c and not scattered around ir-raw-event.c and ir-nec-decoder.c (where it doesn't belong). In addition, I've changed the API slightly so that ir_input_dev is passed as the first argument rather than input_dev. If we're ever going to support multiple keytables we need to move towards making ir_input_dev the main interface from a driver POV and obscure away the input_dev as an implementational detail in ir-core. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/ir-core.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 7a0be8d4999d..b452a478c12c 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -76,7 +76,6 @@ struct ir_raw_event {
struct ir_raw_event_ctrl {
struct kfifo kfifo; /* fifo for the pulse/space events */
struct timespec last_event; /* when last event occurred */
- struct timer_list timer_keyup; /* timer for key release */
};
struct ir_input_dev {
@@ -86,10 +85,16 @@ struct ir_input_dev {
unsigned long devno; /* device number */
const struct ir_dev_props *props; /* Device properties */
struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
+ struct input_dev *input_dev; /* the input device associated with this device */
/* key info - needed by IR keycode handlers */
- u32 keycode; /* linux key code */
- int keypressed; /* current state */
+ spinlock_t keylock; /* protects the below members */
+ bool keypressed; /* current state */
+ unsigned long keyup_jiffies; /* when should the current keypress be released? */
+ struct timer_list timer_keyup; /* timer for releasing a keypress */
+ u32 last_keycode; /* keycode of last command */
+ u32 last_scancode; /* scancode of last command */
+ u8 last_toggle; /* toggle of last command */
};
struct ir_raw_handler {
@@ -115,8 +120,8 @@ void rc_map_init(void);
u32 ir_g_keycode_from_table(struct input_dev *input_dev,
u32 scancode);
-void ir_keyup(struct input_dev *dev);
-void ir_keydown(struct input_dev *dev, int scancode);
+void ir_repeat(struct input_dev *dev);
+void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);
int __ir_input_register(struct input_dev *dev,
const struct ir_scancode_table *ir_codes,
const struct ir_dev_props *props,