From: Vojtech Pavlik <vojtech@suse.cz>
To: torvalds@osdl.org, vojtech@ucw.cz, linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] Fix ACK/NAK handling in libps2.c - don't ignore bytes before ACK
Date: Thu, 27 Jan 2005 18:13:58 +0100 [thread overview]
Message-ID: <11068460382169@twilight.ucw.cz> (raw)
In-Reply-To: <11068460382243@twilight.ucw.cz>
You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/for-linus
===================================================================
ChangeSet@1.1976, 2005-01-27 01:18:50-05:00, dtor_core@ameritech.net
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>
libps2.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
===================================================================
diff -Nru a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
--- a/drivers/input/serio/libps2.c 2005-01-27 17:47:59 +01:00
+++ b/drivers/input/serio/libps2.c 2005-01-27 17:47:59 +01:00
@@ -223,7 +223,8 @@
}
/*
- * 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 @@
}
/* 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)
{
next prev parent reply other threads:[~2005-01-27 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-27 16:59 [bk patches] Input update for 2.6.11 [0/6] Vojtech Pavlik
2005-01-27 17:13 ` [PATCH 1/6] Add support for H-Wheel on Microsoft Explorer and Logitech MX mice Vojtech Pavlik
2005-01-27 17:13 ` [PATCH 2/6] Handle -EILSEQ return code in the HID driver Vojtech Pavlik
2005-01-27 17:13 ` [PATCH 3/6] Always bring the i8042 multiplexer out of multiplexing mode Vojtech Pavlik
2005-01-27 17:13 ` [PATCH 4/6] Enable scancode event generation in the HID driver Vojtech Pavlik
2005-01-27 17:13 ` [PATCH 5/6] Add missing input_sync() calls to atkbd.c Vojtech Pavlik
2005-01-27 17:13 ` Vojtech Pavlik [this message]
2005-01-28 11:26 ` [PATCH 1/1] One more: Fix libps2 timeout handling Vojtech Pavlik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11068460382169@twilight.ucw.cz \
--to=vojtech@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=vojtech@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox