Commit 98563d04 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: ACK/NAK processing rules in libps2 were too strict - while it is a

       good idea to discard any character other than ACK/NAK during probe
       it causes missing releases and keys getting "stuck" when a command
       issued on enabled device. The effect is easily demonstrated with
       the following command:
           while true; do xset led 3; xset -led 3; done

       With this change extra characters will be discarded only if device
       has not been marked as "enabled" yet.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru> 
parent 4941e7d4
......@@ -223,7 +223,8 @@ void ps2_init(struct ps2dev *ps2dev, struct serio *serio)
}
/*
* ps2_handle_ack()
* ps2_handle_ack() is supposed to be used in interrupt handler
* to properly process ACK/NAK of a command from a PS/2 device.
*/
int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
......@@ -250,18 +251,27 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
}
/* Fall through */
default:
return 1;
return 0;
}
if (!ps2dev->nak && ps2dev->cmdcnt)
ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1;
ps2dev->flags &= ~PS2_FLAG_ACK;
wake_up_interruptible(&ps2dev->wait);
return data == PS2_RET_ACK || data == PS2_RET_NAK;
if (data != PS2_RET_ACK)
ps2_handle_response(ps2dev, data);
return 1;
}
/*
* ps2_handle_response() is supposed to be used in interrupt handler
* to properly store device's response to a command and notify process
* waiting for completion of the command.
*/
int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment