diff options
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 136321a2cfdb..8bc9f51ae6c2 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -150,9 +150,20 @@ static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse, struct pt_reg | |||
150 | */ | 150 | */ |
151 | 151 | ||
152 | if (psmouse->type == PSMOUSE_IMEX) { | 152 | if (psmouse->type == PSMOUSE_IMEX) { |
153 | input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7)); | 153 | switch (packet[3] & 0xC0) { |
154 | input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1); | 154 | case 0x80: /* vertical scroll on IntelliMouse Explorer 4.0 */ |
155 | input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1); | 155 | input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31)); |
156 | break; | ||
157 | case 0x40: /* horizontal scroll on IntelliMouse Explorer 4.0 */ | ||
158 | input_report_rel(dev, REL_HWHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31)); | ||
159 | break; | ||
160 | case 0x00: | ||
161 | case 0xC0: | ||
162 | input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7)); | ||
163 | input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1); | ||
164 | input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1); | ||
165 | break; | ||
166 | } | ||
156 | } | 167 | } |
157 | 168 | ||
158 | /* | 169 | /* |
@@ -466,9 +477,25 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties) | |||
466 | if (param[0] != 4) | 477 | if (param[0] != 4) |
467 | return -1; | 478 | return -1; |
468 | 479 | ||
480 | /* Magic to enable horizontal scrolling on IntelliMouse 4.0 */ | ||
481 | param[0] = 200; | ||
482 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
483 | param[0] = 80; | ||
484 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
485 | param[0] = 40; | ||
486 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
487 | |||
488 | param[0] = 200; | ||
489 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
490 | param[0] = 200; | ||
491 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
492 | param[0] = 60; | ||
493 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
494 | |||
469 | if (set_properties) { | 495 | if (set_properties) { |
470 | set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 496 | set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
471 | set_bit(REL_WHEEL, psmouse->dev->relbit); | 497 | set_bit(REL_WHEEL, psmouse->dev->relbit); |
498 | set_bit(REL_HWHEEL, psmouse->dev->relbit); | ||
472 | set_bit(BTN_SIDE, psmouse->dev->keybit); | 499 | set_bit(BTN_SIDE, psmouse->dev->keybit); |
473 | set_bit(BTN_EXTRA, psmouse->dev->keybit); | 500 | set_bit(BTN_EXTRA, psmouse->dev->keybit); |
474 | 501 | ||
@@ -1057,8 +1084,8 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_proto | |||
1057 | if (psmouse->resync_time && psmouse->poll(psmouse)) | 1084 | if (psmouse->resync_time && psmouse->poll(psmouse)) |
1058 | psmouse->resync_time = 0; | 1085 | psmouse->resync_time = 0; |
1059 | 1086 | ||
1060 | sprintf(psmouse->devname, "%s %s %s", | 1087 | snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", |
1061 | psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name); | 1088 | psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name); |
1062 | 1089 | ||
1063 | input_dev->name = psmouse->devname; | 1090 | input_dev->name = psmouse->devname; |
1064 | input_dev->phys = psmouse->phys; | 1091 | input_dev->phys = psmouse->phys; |
@@ -1099,7 +1126,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1099 | ps2_init(&psmouse->ps2dev, serio); | 1126 | ps2_init(&psmouse->ps2dev, serio); |
1100 | INIT_WORK(&psmouse->resync_work, psmouse_resync, psmouse); | 1127 | INIT_WORK(&psmouse->resync_work, psmouse_resync, psmouse); |
1101 | psmouse->dev = input_dev; | 1128 | psmouse->dev = input_dev; |
1102 | sprintf(psmouse->phys, "%s/input0", serio->phys); | 1129 | snprintf(psmouse->phys, sizeof(psmouse->phys), "%s/input0", serio->phys); |
1103 | 1130 | ||
1104 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); | 1131 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); |
1105 | 1132 | ||