From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8M91-0003A2-5f for qemu-devel@nongnu.org; Thu, 02 Jun 2016 02:30:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8M8t-0000r3-Jr for qemu-devel@nongnu.org; Thu, 02 Jun 2016 02:30:14 -0400 Received: from mr213139.mail.yeah.net ([223.252.213.139]:35284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8M8s-0000mI-TJ for qemu-devel@nongnu.org; Thu, 02 Jun 2016 02:30:07 -0400 From: Yang Hongyang Date: Thu, 2 Jun 2016 14:05:05 +0800 Message-Id: <1464847505-27478-1-git-send-email-hongyang.yang@easystack.cn> Subject: [Qemu-devel] [PATCH] ps2: take exact use of ps2 buffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Gonglei , Juan Quintela According to PS/2 Mouse/Keyboard Protocol, the keyboard output buffer size is 16 bytes, but we only use 15 bytes actually, this causes some problem, for example, if I submit "123456789" in a bunch through VNC, the actual result will be "12345678888888888...", because the 16th key event which is "8" key up is dropped. Signed-off-by: Yang Hongyang Cc: Gerd Hoffmann Cc: Gonglei Cc: Juan Quintela --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index a8aa36f..0726270 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -143,7 +143,7 @@ void ps2_queue(void *opaque, int b) PS2State *s = (PS2State *)opaque; PS2Queue *q = &s->queue; - if (q->count >= PS2_QUEUE_SIZE - 1) + if (q->count >= PS2_QUEUE_SIZE) return; q->data[q->wptr] = b; if (++q->wptr == PS2_QUEUE_SIZE) -- 1.8.3.1