From patchwork Thu Jun 2 06:05:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Hongyang X-Patchwork-Id: 9149233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A56556074E for ; Thu, 2 Jun 2016 06:30:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9712D2656B for ; Thu, 2 Jun 2016 06:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89555271FD; Thu, 2 Jun 2016 06:30:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA8742656B for ; Thu, 2 Jun 2016 06:30:37 +0000 (UTC) Received: from localhost ([::1]:45496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8M9M-0003Bt-Pz for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Jun 2016 02:30:36 -0400 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 Received: from centos7.localdomain (unknown [121.225.150.53]) by mr213139.mail.yeah.net (HMail) with ESMTPSA id D2F481C18AB; Thu, 2 Jun 2016 14:05:14 +0800 (CST) From: Yang Hongyang To: qemu-devel@nongnu.org Date: Thu, 2 Jun 2016 14:05:05 +0800 Message-Id: <1464847505-27478-1-git-send-email-hongyang.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQUpOVUNITkJCQk9DQ0NIS05NTVdZCQ4XHghZQV koKz0kNT4uLyk6NyQyNSQzPjo*PilBS1VLQDYjJCI#KCQyNSQzPjo*PilBS1VLQCsvKSQiPigkMj UkMz46Pz4pQUtVS0A4NC41LykiJDg1QUtVS0ApPjwyNDUkOigyOkFLVUtAKyk0LTI1OD4kMTI6NT woLkFLVUtAPyI1OjYyOCQyKyQ1NCQyNSQzPjo*PilBS1VLQCk#OjckMiskMjUkKTk3JDI1JDM#Oj 8#KUFKSVVLQDYuNy8yJCk4Ky8kPzI9PT4pPjUvJDI1JDM#Oj8#KUFJVUtAMiskSEskNjI1Li8#JD g1LyRLJE5LQUtVS0AyKyRKJDYyNS4vPiQ4NS8kSyRKS0FLVUtAMiskLzQ*OiIkODUvJEskSktLQU tVS0AyKyROJDYyNS4vPiQ4NS8kSyRKS0FLVUtAMiskSiQzNC4pJDg1LyRLJEpLS0FLVUtAKC45MT 44LyQvND86IiQ4NS8kSyRKS0tBS1VLQCguOTE#OC8kTiQ2MjUuLz4kODUvJEskSktBS1VLQCguOT E#OC8kSiQzNC4pJDg1LyRLJEpLS0FLVUtAKDkxJDc#NSRPSyQjQUtVS0tKS0AvPiMvJDc#NSRISU skSklDS0FLVUtLSktAODUvJDMvNjckNz41JEowJE4wQUtVS0tKS0ApPjg#Mi0#KSQ4NS8kSiROQU tVS0tKS0A*PjcyLT4pJDc#NSRLQUtVS0tKS0A3OjU8JD41QUtVS0tKS0A9NSQoLjkkPjUsNCk*KC QzNzEkSktLSUtKQUtVSUNAKC45JD5BSlVOTlkG X-HM-Sender-Digest: e1kSHx4VD1lBWUc6Kwg6Pzo5UTosDDoiOksZLwsdPyswFEJVSlVKT01P Q09MTkpOS05MVTMWGhIXVRMUFRwCGhUcVQIaFRw7HhoIAggPGhgQVRgVRVlXWQweGVlBHRoXCB5X WQgBWUFKTEhON1dZEgtZQVlKSUpVSUlOVUpOS1VOSFkG X-HM-Tid: 0a550fb73d257d8bd2f481c18ab X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 223.252.213.139 Subject: [Qemu-devel] [PATCH] ps2: take exact use of ps2 buffer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gonglei , Gerd Hoffmann , Juan Quintela Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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)