[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/5] ps2: correctly handle 'get/set scancode' com
From: |
Hervé Poussineau |
Subject: |
[Qemu-devel] [PATCH v2 2/5] ps2: correctly handle 'get/set scancode' command |
Date: |
Thu, 15 Sep 2016 22:06:24 +0200 |
When getting scancode, current scancode must be preceded from reply ack.
When setting scancode, we must reject invalid scancodes.
Signed-off-by: Hervé Poussineau <address@hidden>
---
hw/input/ps2.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 00a1792..2105e51 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -296,16 +296,18 @@ void ps2_write_keyboard(void *opaque, int val)
break;
case KBD_CMD_SCANCODE:
if (val == 0) {
+ ps2_queue(&s->common, KBD_REPLY_ACK);
if (s->scancode_set == 1)
ps2_put_keycode(s, 0x43);
else if (s->scancode_set == 2)
ps2_put_keycode(s, 0x41);
else if (s->scancode_set == 3)
ps2_put_keycode(s, 0x3f);
- } else {
- if (val >= 1 && val <= 3)
- s->scancode_set = val;
+ } else if (val >= 1 && val <= 3) {
+ s->scancode_set = val;
ps2_queue(&s->common, KBD_REPLY_ACK);
+ } else {
+ ps2_queue(&s->common, KBD_REPLY_RESEND);
}
s->common.write_cmd = -1;
break;
--
2.1.4
- [Qemu-devel] [PATCH v2 0/5] ps2: fix keyboard set 3 and misc improvements, Hervé Poussineau, 2016/09/15
- [Qemu-devel] [PATCH v2 2/5] ps2: correctly handle 'get/set scancode' command,
Hervé Poussineau <=
- [Qemu-devel] [PATCH v2 5/5] ps2: do not generate invalid key codes for unknown keys, Hervé Poussineau, 2016/09/15
- [Qemu-devel] [PATCH v2 3/5] ps2: allow keycode translation for all scancode sets, Hervé Poussineau, 2016/09/15
- [Qemu-devel] [PATCH v2 1/5] ps2: reject unknown commands, instead of blindly accepting them, Hervé Poussineau, 2016/09/15
- [Qemu-devel] [PATCH v2 4/5] ps2: use QEMU qcodes instead of scancodes, Hervé Poussineau, 2016/09/15
- Re: [Qemu-devel] [PATCH v2 0/5] ps2: fix keyboard set 3 and misc improvements, no-reply, 2016/09/15