aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/libps2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/serio/libps2.c')
-rw-r--r--drivers/input/serio/libps2.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index 2b304c22c200..67248c31e19a 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -262,9 +262,17 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
262 break; 262 break;
263 263
264 case PS2_RET_NAK: 264 case PS2_RET_NAK:
265 ps2dev->nak = 1; 265 ps2dev->flags |= PS2_FLAG_NAK;
266 ps2dev->nak = PS2_RET_NAK;
266 break; 267 break;
267 268
269 case PS2_RET_ERR:
270 if (ps2dev->flags & PS2_FLAG_NAK) {
271 ps2dev->flags &= ~PS2_FLAG_NAK;
272 ps2dev->nak = PS2_RET_ERR;
273 break;
274 }
275
268 /* 276 /*
269 * Workaround for mice which don't ACK the Get ID command. 277 * Workaround for mice which don't ACK the Get ID command.
270 * These are valid mouse IDs that we recognize. 278 * These are valid mouse IDs that we recognize.
@@ -282,8 +290,11 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
282 } 290 }
283 291
284 292
285 if (!ps2dev->nak && ps2dev->cmdcnt) 293 if (!ps2dev->nak) {
286 ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1; 294 ps2dev->flags &= ~PS2_FLAG_NAK;
295 if (ps2dev->cmdcnt)
296 ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1;
297 }
287 298
288 ps2dev->flags &= ~PS2_FLAG_ACK; 299 ps2dev->flags &= ~PS2_FLAG_ACK;
289 wake_up(&ps2dev->wait); 300 wake_up(&ps2dev->wait);
@@ -329,6 +340,7 @@ void ps2_cmd_aborted(struct ps2dev *ps2dev)
329 if (ps2dev->flags & (PS2_FLAG_ACK | PS2_FLAG_CMD)) 340 if (ps2dev->flags & (PS2_FLAG_ACK | PS2_FLAG_CMD))
330 wake_up(&ps2dev->wait); 341 wake_up(&ps2dev->wait);
331 342
332 ps2dev->flags = 0; 343 /* reset all flags except last nack */
344 ps2dev->flags &= PS2_FLAG_NAK;
333} 345}
334EXPORT_SYMBOL(ps2_cmd_aborted); 346EXPORT_SYMBOL(ps2_cmd_aborted);