diff options
| author | Andrew Liu <andrew.liu200917@gmail.com> | 2013-11-23 13:06:36 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-11-25 21:26:17 -0500 |
| commit | e4cfb034e89a1c7148f617735d92a3655d27773f (patch) | |
| tree | 5fcd037bdae5695fa786ea691e671c57bb15f67b | |
| parent | 5cf0eb9875cb26ebdc60d08444272b2ea219386e (diff) | |
Input: keyboard - "keycode & KEY_MAX" changes some keycode values
For exmaple, keycode: KEY_OK(0x160) is changed by "and" operation with
KEY_MAX(0x2ff) to KEY_KPENTER(96).
Signed-off-by: Andrew Liu <andrew.liu200917@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| -rw-r--r-- | drivers/input/keyboard/adp5588-keys.c | 3 | ||||
| -rw-r--r-- | drivers/input/keyboard/adp5589-keys.c | 3 | ||||
| -rw-r--r-- | drivers/input/keyboard/bf54x-keys.c | 3 | ||||
| -rw-r--r-- | drivers/input/misc/pcf8574_keypad.c | 7 |
4 files changed, 11 insertions, 5 deletions
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index dbd2047f1641..3ed23513d881 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
| @@ -536,7 +536,8 @@ static int adp5588_probe(struct i2c_client *client, | |||
| 536 | __set_bit(EV_REP, input->evbit); | 536 | __set_bit(EV_REP, input->evbit); |
| 537 | 537 | ||
| 538 | for (i = 0; i < input->keycodemax; i++) | 538 | for (i = 0; i < input->keycodemax; i++) |
| 539 | __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); | 539 | if (kpad->keycode[i] <= KEY_MAX) |
| 540 | __set_bit(kpad->keycode[i], input->keybit); | ||
| 540 | __clear_bit(KEY_RESERVED, input->keybit); | 541 | __clear_bit(KEY_RESERVED, input->keybit); |
| 541 | 542 | ||
| 542 | if (kpad->gpimapsize) | 543 | if (kpad->gpimapsize) |
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 67d12b3427c9..60dafd4fa692 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c | |||
| @@ -992,7 +992,8 @@ static int adp5589_probe(struct i2c_client *client, | |||
| 992 | __set_bit(EV_REP, input->evbit); | 992 | __set_bit(EV_REP, input->evbit); |
| 993 | 993 | ||
| 994 | for (i = 0; i < input->keycodemax; i++) | 994 | for (i = 0; i < input->keycodemax; i++) |
| 995 | __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); | 995 | if (kpad->keycode[i] <= KEY_MAX) |
| 996 | __set_bit(kpad->keycode[i], input->keybit); | ||
| 996 | __clear_bit(KEY_RESERVED, input->keybit); | 997 | __clear_bit(KEY_RESERVED, input->keybit); |
| 997 | 998 | ||
| 998 | if (kpad->gpimapsize) | 999 | if (kpad->gpimapsize) |
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index fc88fb48d70d..09b91d093087 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
| @@ -289,7 +289,8 @@ static int bfin_kpad_probe(struct platform_device *pdev) | |||
| 289 | __set_bit(EV_REP, input->evbit); | 289 | __set_bit(EV_REP, input->evbit); |
| 290 | 290 | ||
| 291 | for (i = 0; i < input->keycodemax; i++) | 291 | for (i = 0; i < input->keycodemax; i++) |
| 292 | __set_bit(bf54x_kpad->keycode[i] & KEY_MAX, input->keybit); | 292 | if (bf54x_kpad->keycode[i] <= KEY_MAX) |
| 293 | __set_bit(bf54x_kpad->keycode[i], input->keybit); | ||
| 293 | __clear_bit(KEY_RESERVED, input->keybit); | 294 | __clear_bit(KEY_RESERVED, input->keybit); |
| 294 | 295 | ||
| 295 | error = input_register_device(input); | 296 | error = input_register_device(input); |
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index e37392976fdd..0deca5a3c87f 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c | |||
| @@ -113,9 +113,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i | |||
| 113 | idev->keycodemax = ARRAY_SIZE(lp->btncode); | 113 | idev->keycodemax = ARRAY_SIZE(lp->btncode); |
| 114 | 114 | ||
| 115 | for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) { | 115 | for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) { |
| 116 | lp->btncode[i] = pcf8574_kp_btncode[i]; | 116 | if (lp->btncode[i] <= KEY_MAX) { |
| 117 | __set_bit(lp->btncode[i] & KEY_MAX, idev->keybit); | 117 | lp->btncode[i] = pcf8574_kp_btncode[i]; |
| 118 | __set_bit(lp->btncode[i], idev->keybit); | ||
| 119 | } | ||
| 118 | } | 120 | } |
| 121 | __clear_bit(KEY_RESERVED, idev->keybit); | ||
| 119 | 122 | ||
| 120 | sprintf(lp->name, DRV_NAME); | 123 | sprintf(lp->name, DRV_NAME); |
| 121 | sprintf(lp->phys, "kp_data/input0"); | 124 | sprintf(lp->phys, "kp_data/input0"); |
