diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-17 01:12:21 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-11-20 03:52:12 -0500 |
commit | 315eb996d5505112b22452ccbc7e01fb02eaae81 (patch) | |
tree | 86abf8a390575efe1bc0b678dbd27310ff351f59 /drivers/input/mouse/psmouse-base.c | |
parent | 0cc1770b66ddc2524ab5f0ed6ba5f2df19d6414a (diff) |
Input: psmouse - rework setting of BTN_MIDDLE capability
Do not start protocol detection assuming that middle mouse is present,
instead let individual protocols explicitly set this capability.
This fixes issue with Synaptics touchpads pretending that they have
middle button when hardware clearly reports otherwise.
Reported-and-tested-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 690aed905436..e1c9fe210083 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -425,6 +425,7 @@ static int genius_detect(struct psmouse *psmouse, bool set_properties) | |||
425 | return -1; | 425 | return -1; |
426 | 426 | ||
427 | if (set_properties) { | 427 | if (set_properties) { |
428 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
428 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 429 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
429 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 430 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
430 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 431 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
@@ -460,8 +461,10 @@ static int intellimouse_detect(struct psmouse *psmouse, bool set_properties) | |||
460 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 461 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
461 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 462 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
462 | 463 | ||
463 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 464 | if (!psmouse->vendor) |
464 | if (!psmouse->name) psmouse->name = "Wheel Mouse"; | 465 | psmouse->vendor = "Generic"; |
466 | if (!psmouse->name) | ||
467 | psmouse->name = "Wheel Mouse"; | ||
465 | psmouse->pktsize = 4; | 468 | psmouse->pktsize = 4; |
466 | } | 469 | } |
467 | 470 | ||
@@ -504,8 +507,10 @@ static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) | |||
504 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 507 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
505 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 508 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
506 | 509 | ||
507 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 510 | if (!psmouse->vendor) |
508 | if (!psmouse->name) psmouse->name = "Explorer Mouse"; | 511 | psmouse->vendor = "Generic"; |
512 | if (!psmouse->name) | ||
513 | psmouse->name = "Explorer Mouse"; | ||
509 | psmouse->pktsize = 4; | 514 | psmouse->pktsize = 4; |
510 | } | 515 | } |
511 | 516 | ||
@@ -536,6 +541,7 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
536 | return -1; | 541 | return -1; |
537 | 542 | ||
538 | if (set_properties) { | 543 | if (set_properties) { |
544 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
539 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 545 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
540 | 546 | ||
541 | psmouse->vendor = "Kensington"; | 547 | psmouse->vendor = "Kensington"; |
@@ -551,8 +557,16 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
551 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) | 557 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) |
552 | { | 558 | { |
553 | if (set_properties) { | 559 | if (set_properties) { |
554 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 560 | if (!psmouse->vendor) |
555 | if (!psmouse->name) psmouse->name = "Mouse"; | 561 | psmouse->vendor = "Generic"; |
562 | if (!psmouse->name) | ||
563 | psmouse->name = "Mouse"; | ||
564 | |||
565 | /* | ||
566 | * We have no way of figuring true number of buttons so let's | ||
567 | * assume that the device has 3. | ||
568 | */ | ||
569 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
556 | } | 570 | } |
557 | 571 | ||
558 | return 0; | 572 | return 0; |
@@ -567,6 +581,8 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) | |||
567 | if (set_properties) { | 581 | if (set_properties) { |
568 | psmouse->vendor = "Cortron"; | 582 | psmouse->vendor = "Cortron"; |
569 | psmouse->name = "PS/2 Trackball"; | 583 | psmouse->name = "PS/2 Trackball"; |
584 | |||
585 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
570 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 586 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
571 | } | 587 | } |
572 | 588 | ||
@@ -1184,15 +1200,16 @@ static void psmouse_disconnect(struct serio *serio) | |||
1184 | mutex_unlock(&psmouse_mutex); | 1200 | mutex_unlock(&psmouse_mutex); |
1185 | } | 1201 | } |
1186 | 1202 | ||
1187 | static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto) | 1203 | static int psmouse_switch_protocol(struct psmouse *psmouse, |
1204 | const struct psmouse_protocol *proto) | ||
1188 | { | 1205 | { |
1189 | struct input_dev *input_dev = psmouse->dev; | 1206 | struct input_dev *input_dev = psmouse->dev; |
1190 | 1207 | ||
1191 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; | 1208 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; |
1192 | 1209 | ||
1193 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 1210 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
1194 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | | 1211 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = |
1195 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 1212 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
1196 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 1213 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
1197 | 1214 | ||
1198 | psmouse->set_rate = psmouse_set_rate; | 1215 | psmouse->set_rate = psmouse_set_rate; |
@@ -1209,8 +1226,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse | |||
1209 | return -1; | 1226 | return -1; |
1210 | 1227 | ||
1211 | psmouse->type = proto->type; | 1228 | psmouse->type = proto->type; |
1212 | } | 1229 | } else |
1213 | else | ||
1214 | psmouse->type = psmouse_extensions(psmouse, | 1230 | psmouse->type = psmouse_extensions(psmouse, |
1215 | psmouse_max_proto, true); | 1231 | psmouse_max_proto, true); |
1216 | 1232 | ||