From e7b5c1ef4d87426da0b689a0a4fa67edda02ea5c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 29 Jan 2009 23:17:52 -0800 Subject: Input: stop autorepeat timer on key release Whenever you press and then release a key, the CPU wakes up three times: * press * release * autorepeat timer exactly 250ms after press The autorepeat timer has nothing to do, obviously, since you already have released the key, so stop it on key release. [dtor@mail.ru: This changes autorepeat behavior a bit since we now stop autorepeat even if key that is being released is not the one that is being auto-repeated, but I believe the new behavior is better.] Signed-off-by: Johannes Berg Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/input/input.c') diff --git a/drivers/input/input.c b/drivers/input/input.c index 1730d73..46e9ce1 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -132,6 +132,11 @@ static void input_start_autorepeat(struct input_dev *dev, int code) } } +static void input_stop_autorepeat(struct input_dev *dev) +{ + del_timer(&dev->timer); +} + #define INPUT_IGNORE_EVENT 0 #define INPUT_PASS_TO_HANDLERS 1 #define INPUT_PASS_TO_DEVICE 2 @@ -167,6 +172,8 @@ static void input_handle_event(struct input_dev *dev, __change_bit(code, dev->key); if (value) input_start_autorepeat(dev, code); + else + input_stop_autorepeat(dev); } disposition = INPUT_PASS_TO_HANDLERS; -- cgit v1.1 From fa88661224946145819a904cef2ec7dd5c9c78bc Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Wed, 4 Mar 2009 00:52:20 -0800 Subject: Input: fix polling of /proc/bus/input/devices Tested-by: Alessio Sangalli Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/input/input.c') diff --git a/drivers/input/input.c b/drivers/input/input.c index 46e9ce1..913392f 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -744,11 +744,11 @@ static inline void input_wakeup_procfs_readers(void) static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) { - int state = input_devices_state; - poll_wait(file, &input_devices_poll_wait, wait); - if (state != input_devices_state) + if (file->f_version != input_devices_state) { + file->f_version = input_devices_state; return POLLIN | POLLRDNORM; + } return 0; } -- cgit v1.1