aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-05 20:56:00 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-06 03:26:20 -0500
commit4f93df40859cf471774f6ef3ec7f2870c2e8e260 (patch)
tree78b7e983b5e6fb93319e1772ef529e8b0e763365 /drivers/input
parentfc99ec6f4b6116305bca56a781b8b3b2ac054d27 (diff)
Input: automatically reset KEY_RESERVED bit for all input devices
KEY_RESERVED is not supposed to be reported to userspace but rather to mark unused entries in keymaps. Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index ab060710688f..910d7be06eff 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -613,12 +613,12 @@ static int input_default_setkeycode(struct input_dev *dev,
613 } 613 }
614 } 614 }
615 615
616 clear_bit(old_keycode, dev->keybit); 616 __clear_bit(old_keycode, dev->keybit);
617 set_bit(keycode, dev->keybit); 617 __set_bit(keycode, dev->keybit);
618 618
619 for (i = 0; i < dev->keycodemax; i++) { 619 for (i = 0; i < dev->keycodemax; i++) {
620 if (input_fetch_keycode(dev, i) == old_keycode) { 620 if (input_fetch_keycode(dev, i) == old_keycode) {
621 set_bit(old_keycode, dev->keybit); 621 __set_bit(old_keycode, dev->keybit);
622 break; /* Setting the bit twice is useless, so break */ 622 break; /* Setting the bit twice is useless, so break */
623 } 623 }
624 } 624 }
@@ -676,6 +676,9 @@ int input_set_keycode(struct input_dev *dev, int scancode, int keycode)
676 if (retval) 676 if (retval)
677 goto out; 677 goto out;
678 678
679 /* Make sure KEY_RESERVED did not get enabled. */
680 __clear_bit(KEY_RESERVED, dev->keybit);
681
679 /* 682 /*
680 * Simulate keyup event if keycode is not present 683 * Simulate keyup event if keycode is not present
681 * in the keymap anymore 684 * in the keymap anymore
@@ -1513,13 +1516,16 @@ int input_register_device(struct input_dev *dev)
1513 const char *path; 1516 const char *path;
1514 int error; 1517 int error;
1515 1518
1519 /* Every input device generates EV_SYN/SYN_REPORT events. */
1516 __set_bit(EV_SYN, dev->evbit); 1520 __set_bit(EV_SYN, dev->evbit);
1517 1521
1522 /* KEY_RESERVED is not supposed to be transmitted to userspace. */
1523 __clear_bit(KEY_RESERVED, dev->keybit);
1524
1518 /* 1525 /*
1519 * If delay and period are pre-set by the driver, then autorepeating 1526 * If delay and period are pre-set by the driver, then autorepeating
1520 * is handled by the driver itself and we don't do it in input.c. 1527 * is handled by the driver itself and we don't do it in input.c.
1521 */ 1528 */
1522
1523 init_timer(&dev->timer); 1529 init_timer(&dev->timer);
1524 if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { 1530 if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
1525 dev->timer.data = (long) dev; 1531 dev->timer.data = (long) dev;