aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/sermouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/sermouse.c')
-rw-r--r--drivers/input/mouse/sermouse.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index a85d74710b44..77b8ee2b9651 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -69,7 +69,8 @@ static void sermouse_process_msc(struct sermouse *sermouse, signed char data)
69 switch (sermouse->count) { 69 switch (sermouse->count) {
70 70
71 case 0: 71 case 0:
72 if ((data & 0xf8) != 0x80) return; 72 if ((data & 0xf8) != 0x80)
73 return;
73 input_report_key(dev, BTN_LEFT, !(data & 4)); 74 input_report_key(dev, BTN_LEFT, !(data & 4));
74 input_report_key(dev, BTN_RIGHT, !(data & 1)); 75 input_report_key(dev, BTN_RIGHT, !(data & 1));
75 input_report_key(dev, BTN_MIDDLE, !(data & 2)); 76 input_report_key(dev, BTN_MIDDLE, !(data & 2));
@@ -107,7 +108,10 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
107 struct input_dev *dev = sermouse->dev; 108 struct input_dev *dev = sermouse->dev;
108 signed char *buf = sermouse->buf; 109 signed char *buf = sermouse->buf;
109 110
110 if (data & 0x40) sermouse->count = 0; 111 if (data & 0x40)
112 sermouse->count = 0;
113 else if (sermouse->count == 0)
114 return;
111 115
112 switch (sermouse->count) { 116 switch (sermouse->count) {
113 117
@@ -169,7 +173,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
169 173
170 case 5: 174 case 5:
171 case 7: /* Ignore anything besides MZ++ */ 175 case 7: /* Ignore anything besides MZ++ */
172 if (sermouse->type != SERIO_MZPP) break; 176 if (sermouse->type != SERIO_MZPP)
177 break;
173 178
174 switch (buf[1]) { 179 switch (buf[1]) {
175 180
@@ -206,13 +211,16 @@ static irqreturn_t sermouse_interrupt(struct serio *serio,
206{ 211{
207 struct sermouse *sermouse = serio_get_drvdata(serio); 212 struct sermouse *sermouse = serio_get_drvdata(serio);
208 213
209 if (time_after(jiffies, sermouse->last + HZ/10)) sermouse->count = 0; 214 if (time_after(jiffies, sermouse->last + HZ/10))
215 sermouse->count = 0;
216
210 sermouse->last = jiffies; 217 sermouse->last = jiffies;
211 218
212 if (sermouse->type > SERIO_SUN) 219 if (sermouse->type > SERIO_SUN)
213 sermouse_process_ms(sermouse, data); 220 sermouse_process_ms(sermouse, data);
214 else 221 else
215 sermouse_process_msc(sermouse, data); 222 sermouse_process_msc(sermouse, data);
223
216 return IRQ_HANDLED; 224 return IRQ_HANDLED;
217} 225}
218 226
@@ -258,12 +266,11 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
258 input_dev->id.vendor = sermouse->type; 266 input_dev->id.vendor = sermouse->type;
259 input_dev->id.product = c; 267 input_dev->id.product = c;
260 input_dev->id.version = 0x0100; 268 input_dev->id.version = 0x0100;
261 input_dev->cdev.dev = &serio->dev; 269 input_dev->dev.parent = &serio->dev;
262 270
263 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 271 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
264 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 272 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
265 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 273 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
266 input_dev->private = sermouse;
267 274
268 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); 275 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit);
269 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); 276 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit);