qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bohdan Kostiv <bogdan.kostiv@gmail.com>
To: qemu-devel@nongnu.org
Subject: [PATCH] Fixed '-serial none' usage breaks following '-serial ...' usage
Date: Wed, 10 Jan 2024 11:46:42 +0400	[thread overview]
Message-ID: <CAA3Sv1LQ8yDUNLCB5WqLVZjsHffrU0uSbL_YYJW_m+Db2PhEeQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 598 bytes --]

Hello,

I have faced an issue in using serial ports when I need to skip a couple of
ports in the CLI.

For example the ARM machine netduinoplus2 supports up to 7 UARTS.
Following case works (the first UART is used to send data in the firmware):
qemu-system-arm -machine netduinoplus2 -nographic -serial mon:stdio -kernel
path-to-fw/firmware.elf
But this one doesn't  (the third UART is used to send data in the firmware):
qemu-system-arm -machine netduinoplus2 -nographic -serial none -serial none
-serial mon:stdio -kernel path-to-fw/firmware.elf

The patch fixes the issue.

Best regards,
Bohdan

[-- Attachment #1.2: Type: text/html, Size: 1536 bytes --]

[-- Attachment #2: 0001-Fixed-serial-none-breaks-following-serial.patch --]
[-- Type: application/octet-stream, Size: 883 bytes --]

From ee8023f3d466c3a5ad9cb9d117e11501c44da377 Mon Sep 17 00:00:00 2001
From: Bohdan Kostiv <bogdan.kostiv@gmail.com>
Date: Wed, 10 Jan 2024 11:09:11 +0400
Subject: [PATCH] Fixed '-serial none' usage breaks following '-serial ...' usage 

Signed-off-by: Bohdan Kostiv <bohdan.kostiv@tii.ae>
---
 system/vl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/system/vl.c b/system/vl.c
index 2bcd9efb9a..b8744475cd 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1442,8 +1442,11 @@ static int serial_parse(const char *devname)
     int index = num_serial_hds;
     char label[32];
 
-    if (strcmp(devname, "none") == 0)
+    if (strcmp(devname, "none") == 0) {
+        num_serial_hds++;
         return 0;
+    }
+
     snprintf(label, sizeof(label), "serial%d", index);
     serial_hds = g_renew(Chardev *, serial_hds, index + 1);
 
-- 
2.39.3 (Apple Git-145)


             reply	other threads:[~2024-01-10 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10  7:46 Bohdan Kostiv [this message]
2024-01-12 18:30 ` [PATCH] Fixed '-serial none' usage breaks following '-serial ...' usage Peter Maydell
2024-01-15 16:14 ` Peter Maydell
2024-01-16  7:33   ` Markus Armbruster
2024-01-16 17:34   ` Daniel P. Berrangé
2024-01-22 15:54   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA3Sv1LQ8yDUNLCB5WqLVZjsHffrU0uSbL_YYJW_m+Db2PhEeQ@mail.gmail.com \
    --to=bogdan.kostiv@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).