From patchwork Sun Sep 12 12:52:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 12486855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF26BC433F5 for ; Sun, 12 Sep 2021 12:54:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A244961050 for ; Sun, 12 Sep 2021 12:54:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A244961050 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPOzh-0007Vj-TE for qemu-devel@archiver.kernel.org; Sun, 12 Sep 2021 08:54:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOxx-0004pL-JT for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:52:13 -0400 Received: from mailout04.t-online.de ([194.25.134.18]:46200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOxu-00083J-MP for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:52:12 -0400 Received: from fwd73.dcpf.telekom.de (fwd73.aul.t-online.de [10.223.144.99]) by mailout04.t-online.de (Postfix) with SMTP id 9E97A29E7; Sun, 12 Sep 2021 14:52:06 +0200 (CEST) Received: from linpower.localnet ([79.208.16.31]) by fwd73.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1mPOxo-1TmU5Z0; Sun, 12 Sep 2021 14:52:04 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id 024C720061B; Sun, 12 Sep 2021 14:52:03 +0200 (CEST) From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 1/3] ui/console: replace QEMUFIFO with Fifo8 Date: Sun, 12 Sep 2021 14:52:01 +0200 Message-Id: <20210912125203.7114-1-vr_qemu@t-online.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> References: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> MIME-Version: 1.0 X-TOI-EXPURGATEID: 150726::1631451124-00004599-DCC95A76/0/0 CLEAN NORMAL X-TOI-MSGID: 4dcee977-be24-455c-b3ce-41aff26edeb1 Received-SPF: none client-ip=194.25.134.18; envelope-from=volker.ruemelin@t-online.de; helo=mailout04.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" One of the two FIFO implementations QEMUFIFO and Fifo8 is redundant. Replace QEMUFIFO with Fifo8. Signed-off-by: Volker Rümelin --- ui/console.c | 86 ++++++++++++---------------------------------------- 1 file changed, 20 insertions(+), 66 deletions(-) diff --git a/ui/console.c b/ui/console.c index eabbbc951c..e6ce29024c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -27,6 +27,7 @@ #include "hw/qdev-core.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" +#include "qemu/fifo8.h" #include "qemu/module.h" #include "qemu/option.h" #include "qemu/timer.h" @@ -62,57 +63,6 @@ enum TTYState { TTY_STATE_CSI, }; -typedef struct QEMUFIFO { - uint8_t *buf; - int buf_size; - int count, wptr, rptr; -} QEMUFIFO; - -static int qemu_fifo_write(QEMUFIFO *f, const uint8_t *buf, int len1) -{ - int l, len; - - l = f->buf_size - f->count; - if (len1 > l) - len1 = l; - len = len1; - while (len > 0) { - l = f->buf_size - f->wptr; - if (l > len) - l = len; - memcpy(f->buf + f->wptr, buf, l); - f->wptr += l; - if (f->wptr >= f->buf_size) - f->wptr = 0; - buf += l; - len -= l; - } - f->count += len1; - return len1; -} - -static int qemu_fifo_read(QEMUFIFO *f, uint8_t *buf, int len1) -{ - int l, len; - - if (len1 > f->count) - len1 = f->count; - len = len1; - while (len > 0) { - l = f->buf_size - f->rptr; - if (l > len) - l = len; - memcpy(buf, f->buf + f->rptr, l); - f->rptr += l; - if (f->rptr >= f->buf_size) - f->rptr = 0; - buf += l; - len -= l; - } - f->count -= len1; - return len1; -} - typedef enum { GRAPHIC_CONSOLE, TEXT_CONSOLE, @@ -165,8 +115,7 @@ struct QemuConsole { Chardev *chr; /* fifo for key pressed */ - QEMUFIFO out_fifo; - uint8_t out_fifo_buf[16]; + Fifo8 out_fifo; QEMUTimer *kbd_timer; CoQueue dump_queue; @@ -1160,21 +1109,25 @@ static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) static void kbd_send_chars(void *opaque) { QemuConsole *s = opaque; - int len; - uint8_t buf[16]; + uint32_t len, avail; len = qemu_chr_be_can_write(s->chr); - if (len > s->out_fifo.count) - len = s->out_fifo.count; - if (len > 0) { - if (len > sizeof(buf)) - len = sizeof(buf); - qemu_fifo_read(&s->out_fifo, buf, len); - qemu_chr_be_write(s->chr, buf, len); + avail = fifo8_num_used(&s->out_fifo); + if (len > avail) { + len = avail; + } + while (len > 0) { + const uint8_t *buf; + uint32_t size; + + buf = fifo8_pop_buf(&s->out_fifo, len, &size); + qemu_chr_be_write(s->chr, (uint8_t *)buf, size); + len -= size; + avail -= size; } /* characters are pending: we send them a bit later (XXX: horrible, should change char device API) */ - if (s->out_fifo.count > 0) { + if (avail > 0) { timer_mod(s->kbd_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1); } } @@ -1185,6 +1138,7 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym) uint8_t buf[16], *q; CharBackend *be; int c; + uint32_t free; if (!s || (s->console_type == GRAPHIC_CONSOLE)) return; @@ -1228,7 +1182,8 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym) } be = s->chr->be; if (be && be->chr_read) { - qemu_fifo_write(&s->out_fifo, buf, q - buf); + free = fifo8_num_free(&s->out_fifo); + fifo8_push_all(&s->out_fifo, buf, MIN(free, q - buf)); kbd_send_chars(s); } break; @@ -2233,8 +2188,7 @@ static void text_console_do_init(Chardev *chr, DisplayState *ds) int g_width = 80 * FONT_WIDTH; int g_height = 24 * FONT_HEIGHT; - s->out_fifo.buf = s->out_fifo_buf; - s->out_fifo.buf_size = sizeof(s->out_fifo_buf); + fifo8_create(&s->out_fifo, 16); s->kbd_timer = timer_new_ms(QEMU_CLOCK_REALTIME, kbd_send_chars, s); s->ds = ds; From patchwork Sun Sep 12 12:52:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 12486865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB3CC433EF for ; Sun, 12 Sep 2021 13:03:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8829D61050 for ; Sun, 12 Sep 2021 13:03:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8829D61050 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:45468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPP8Z-0008ME-Jx for qemu-devel@archiver.kernel.org; Sun, 12 Sep 2021 09:03:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPP0R-0001Wb-Di for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:54:49 -0400 Received: from mailout09.t-online.de ([194.25.134.84]:45466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPP0N-0000S3-My for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:54:45 -0400 Received: from fwd72.dcpf.telekom.de (fwd72.aul.t-online.de [10.223.144.98]) by mailout09.t-online.de (Postfix) with SMTP id 5FE301A213; Sun, 12 Sep 2021 14:52:14 +0200 (CEST) Received: from linpower.localnet ([79.208.16.31]) by fwd72.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1mPOxq-2p2jE90; Sun, 12 Sep 2021 14:52:07 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id 040DF200627; Sun, 12 Sep 2021 14:52:04 +0200 (CEST) From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 2/3] ui/console: replace kbd_timer with chr_accept_input callback Date: Sun, 12 Sep 2021 14:52:02 +0200 Message-Id: <20210912125203.7114-2-vr_qemu@t-online.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> References: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> MIME-Version: 1.0 X-TOI-EXPURGATEID: 150726::1631451127-0000EB0E-89DEB23D/0/0 CLEAN NORMAL X-TOI-MSGID: fd73928f-ef55-412b-864e-2f06937839c5 Received-SPF: none client-ip=194.25.134.84; envelope-from=volker.ruemelin@t-online.de; helo=mailout09.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" There's a ChardevClass chr_accept_input() callback function that can replace the write retry timer. Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau --- ui/console.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ui/console.c b/ui/console.c index e6ce29024c..7b276bfc6c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -116,7 +116,6 @@ struct QemuConsole { Chardev *chr; /* fifo for key pressed */ Fifo8 out_fifo; - QEMUTimer *kbd_timer; CoQueue dump_queue; QTAILQ_ENTRY(QemuConsole) next; @@ -1106,30 +1105,21 @@ static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) return len; } -static void kbd_send_chars(void *opaque) +static void kbd_send_chars(QemuConsole *s) { - QemuConsole *s = opaque; uint32_t len, avail; len = qemu_chr_be_can_write(s->chr); avail = fifo8_num_used(&s->out_fifo); - if (len > avail) { - len = avail; - } - while (len > 0) { + while (len > 0 && avail > 0) { const uint8_t *buf; uint32_t size; - buf = fifo8_pop_buf(&s->out_fifo, len, &size); + buf = fifo8_pop_buf(&s->out_fifo, MIN(len, avail), &size); qemu_chr_be_write(s->chr, (uint8_t *)buf, size); - len -= size; + len = qemu_chr_be_can_write(s->chr); avail -= size; } - /* characters are pending: we send them a bit later (XXX: - horrible, should change char device API) */ - if (avail > 0) { - timer_mod(s->kbd_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1); - } } /* called when an ascii key is pressed */ @@ -2141,6 +2131,14 @@ int qemu_console_get_height(QemuConsole *con, int fallback) return con ? surface_height(con->surface) : fallback; } +static void vc_chr_accept_input(Chardev *chr) +{ + VCChardev *drv = VC_CHARDEV(chr); + QemuConsole *s = drv->console; + + kbd_send_chars(s); +} + static void vc_chr_set_echo(Chardev *chr, bool echo) { VCChardev *drv = VC_CHARDEV(chr); @@ -2189,7 +2187,6 @@ static void text_console_do_init(Chardev *chr, DisplayState *ds) int g_height = 24 * FONT_HEIGHT; fifo8_create(&s->out_fifo, 16); - s->kbd_timer = timer_new_ms(QEMU_CLOCK_REALTIME, kbd_send_chars, s); s->ds = ds; s->y_displayed = 0; @@ -2439,6 +2436,7 @@ static void char_vc_class_init(ObjectClass *oc, void *data) cc->parse = qemu_chr_parse_vc; cc->open = vc_chr_open; cc->chr_write = vc_chr_write; + cc->chr_accept_input = vc_chr_accept_input; cc->chr_set_echo = vc_chr_set_echo; } From patchwork Sun Sep 12 12:52:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 12486857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78502C433EF for ; Sun, 12 Sep 2021 12:54:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22AFD6103D for ; Sun, 12 Sep 2021 12:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 22AFD6103D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPOzj-0007ZA-9y for qemu-devel@archiver.kernel.org; Sun, 12 Sep 2021 08:54:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOy1-0004rd-Px for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:52:19 -0400 Received: from mailout03.t-online.de ([194.25.134.81]:35136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOxz-00085G-1j for qemu-devel@nongnu.org; Sun, 12 Sep 2021 08:52:17 -0400 Received: from fwd78.dcpf.telekom.de (fwd78.aul.t-online.de [10.223.144.104]) by mailout03.t-online.de (Postfix) with SMTP id 81FE43FE1; Sun, 12 Sep 2021 14:52:13 +0200 (CEST) Received: from linpower.localnet ([79.208.16.31]) by fwd78.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1mPOxt-157aAD0; Sun, 12 Sep 2021 14:52:09 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id 05F7E200630; Sun, 12 Sep 2021 14:52:04 +0200 (CEST) From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 3/3] ui/console: remove chardev frontend connected test Date: Sun, 12 Sep 2021 14:52:03 +0200 Message-Id: <20210912125203.7114-3-vr_qemu@t-online.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> References: <23041f12-b405-7dbc-b098-e9c48802e29c@t-online.de> MIME-Version: 1.0 X-TOI-EXPURGATEID: 150726::1631451129-00016B91-73612273/0/0 CLEAN NORMAL X-TOI-MSGID: 18f181b3-040a-4474-b64f-2f07e4c0d8a5 Received-SPF: none client-ip=194.25.134.81; envelope-from=volker.ruemelin@t-online.de; helo=mailout03.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The test if the chardev frontend is connected in kbd_put_keysym_console() is redundant, because the call to qemu_chr_be_can_write() in kbd_send_chars() tests the connected condition again. Remove the redundant test whether the chardev frontend is connected. Signed-off-by: Volker Rümelin Reviewed-by: Marc-André Lureau --- ui/console.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ui/console.c b/ui/console.c index 7b276bfc6c..a06442ed86 100644 --- a/ui/console.c +++ b/ui/console.c @@ -28,10 +28,11 @@ #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" #include "qemu/fifo8.h" +#include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" #include "qemu/timer.h" -#include "chardev/char-fe.h" +#include "chardev/char.h" #include "trace.h" #include "exec/memory.h" #include "io/channel-file.h" @@ -1126,7 +1127,6 @@ static void kbd_send_chars(QemuConsole *s) void kbd_put_keysym_console(QemuConsole *s, int keysym) { uint8_t buf[16], *q; - CharBackend *be; int c; uint32_t free; @@ -1170,12 +1170,9 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym) if (s->echo) { vc_chr_write(s->chr, buf, q - buf); } - be = s->chr->be; - if (be && be->chr_read) { - free = fifo8_num_free(&s->out_fifo); - fifo8_push_all(&s->out_fifo, buf, MIN(free, q - buf)); - kbd_send_chars(s); - } + free = fifo8_num_free(&s->out_fifo); + fifo8_push_all(&s->out_fifo, buf, MIN(free, q - buf)); + kbd_send_chars(s); break; } }