qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 10/17] wctablet: move init/detect sequence


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 10/17] wctablet: move init/detect sequence
Date: Fri, 6 Jan 2017 09:55:38 +0100

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]