From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPQJg-0006R5-Nf for qemu-devel@nongnu.org; Fri, 06 Jan 2017 03:56:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPQJe-0008NL-K6 for qemu-devel@nongnu.org; Fri, 06 Jan 2017 03:56:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57042) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cPQJe-0008MK-Fm for qemu-devel@nongnu.org; Fri, 06 Jan 2017 03:56:02 -0500 From: Gerd Hoffmann Date: Fri, 6 Jan 2017 09:55:38 +0100 Message-Id: <1483692945-9866-11-git-send-email-kraxel@redhat.com> In-Reply-To: <1483692945-9866-1-git-send-email-kraxel@redhat.com> References: <1483692945-9866-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 10/17] wctablet: move init/detect sequence List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: avg.tolik@gmail.com, Gerd Hoffmann Move init/detect detection, handle it as special case. It is the only sequence which doesn't end with a newline. Signed-off-by: Gerd Hoffmann --- backends/wctablet.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/backends/wctablet.c b/backends/wctablet.c index 2b14241..5c41bc4 100644 --- a/backends/wctablet.c +++ b/backends/wctablet.c @@ -245,14 +245,17 @@ static int wctablet_chr_write(struct CharDriverState *s, return len; } + if (strncmp((char *)tablet->query, "~#", 2) == 0) { + /* init / detect sequence */ + wctablet_shift_input(tablet, 2); + wctablet_queue_output(tablet, WC_MODEL_STRING, + WC_MODEL_STRING_LENGTH); + return len; + } + int comm = wctablet_check_command(tablet->query, tablet->query_index); if (comm != -1) { - if (comm == 1) { - wctablet_queue_output(tablet, WC_MODEL_STRING, - WC_MODEL_STRING_LENGTH); - } - if (comm == 3) { wctablet_queue_output(tablet, WC_CONFIG_STRING, WC_CONFIG_STRING_LENGTH); -- 1.8.3.1