- if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID &&
- psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) {
+ timeout = wait_event_interruptible_timeout(psmouse->wait,
+ !test_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags), timeout);
+
+ if (psmouse->cmdcnt && timeout > 0) {
+ if (command == PSMOUSE_CMD_RESET_BAT && jiffies_to_msecs(timeout) > 100)
+ timeout = msecs_to_jiffies(100);
+
+ if (command == PSMOUSE_CMD_GETID &&
+ psmouse->cmdbuf[receive - 1] != 0xab && psmouse->cmdbuf[receive - 1] != 0xac) {
+ /*
+ * Device behind the port is not a keyboard
+ * so we don't need to wait for the 2nd byte
+ * of ID response.
+ */
+ clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags);