Commit 0672120a authored by Henrik Rydberg's avatar Henrik Rydberg

Input: Make sure we follow all EV_KEY events

For some EV_KEY types, sending a larger-than-one value causes the
input state to oscillate. This patch makes sure this cannot happen,
clearing up the autorepeat bypass logic in the process.
Tested-by: default avatarBenjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: default avatarPing Cheng <pingc@wacom.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
parent 7c75bf99
...@@ -240,24 +240,30 @@ static void input_handle_event(struct input_dev *dev, ...@@ -240,24 +240,30 @@ static void input_handle_event(struct input_dev *dev,
break; break;
case EV_KEY: case EV_KEY:
if (is_event_supported(code, dev->keybit, KEY_MAX) && if (is_event_supported(code, dev->keybit, KEY_MAX)) {
!!test_bit(code, dev->key) != value) {
/* auto-repeat bypasses state updates */
if (value == 2) {
disposition = INPUT_PASS_TO_HANDLERS;
break;
}
if (!!test_bit(code, dev->key) != !!value) {
if (value != 2) {
__change_bit(code, dev->key); __change_bit(code, dev->key);
disposition = INPUT_PASS_TO_HANDLERS;
if (value) if (value)
input_start_autorepeat(dev, code); input_start_autorepeat(dev, code);
else else
input_stop_autorepeat(dev); input_stop_autorepeat(dev);
} }
disposition = INPUT_PASS_TO_HANDLERS;
} }
break; break;
case EV_SW: case EV_SW:
if (is_event_supported(code, dev->swbit, SW_MAX) && if (is_event_supported(code, dev->swbit, SW_MAX) &&
!!test_bit(code, dev->sw) != value) { !!test_bit(code, dev->sw) != !!value) {
__change_bit(code, dev->sw); __change_bit(code, dev->sw);
disposition = INPUT_PASS_TO_HANDLERS; disposition = INPUT_PASS_TO_HANDLERS;
...@@ -284,7 +290,7 @@ static void input_handle_event(struct input_dev *dev, ...@@ -284,7 +290,7 @@ static void input_handle_event(struct input_dev *dev,
case EV_LED: case EV_LED:
if (is_event_supported(code, dev->ledbit, LED_MAX) && if (is_event_supported(code, dev->ledbit, LED_MAX) &&
!!test_bit(code, dev->led) != value) { !!test_bit(code, dev->led) != !!value) {
__change_bit(code, dev->led); __change_bit(code, dev->led);
disposition = INPUT_PASS_TO_ALL; disposition = INPUT_PASS_TO_ALL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment