qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] serial stdio char drop fix
Date: Fri, 17 Dec 2004 20:46:41 +0100	[thread overview]
Message-ID: <aec7e5c304121711462071a953@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

Hello,

This little patch makes the serial port connected to stdio work
correctly. Without the patch chars sent from the host to the guest are
silently dropped if the uart is full.  And that happens now and then.
Now with the patch it is possible to correctly paste many lines of
sh-scripts to the serial console on a Linux guest!

/ magnus

[-- Attachment #2: qemu-cvs_20041217-stdio_serial.patch --]
[-- Type: application/octet-stream, Size: 963 bytes --]

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.110
diff -u -r1.110 vl.c
--- vl.c	12 Dec 2004 22:20:04 -0000	1.110
+++ vl.c	17 Dec 2004 19:39:11 -0000
@@ -1173,18 +1173,21 @@
             chr = stdio_clients[client_index];
             s = chr->opaque;
             buf[0] = ch;
-            /* XXX: should queue the char if the device is not
-               ready */
-            if (s->fd_can_read(s->fd_opaque) > 0) 
-                s->fd_read(s->fd_opaque, buf, 1);
+
+            s->fd_read(s->fd_opaque, buf, 1);
         }
     }
 }
 
 static int stdio_can_read(void *opaque)
 {
-    /* XXX: not strictly correct */
-    return 1;
+    CharDriverState *chr;
+    FDCharDriver *s;
+
+    chr = stdio_clients[client_index];
+    s = chr->opaque;
+
+    return s->fd_can_read(s->fd_opaque) > 0;
 }
 
 static void stdio_read(void *opaque, const uint8_t *buf, int size)

                 reply	other threads:[~2004-12-17 21:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=aec7e5c304121711462071a953@mail.gmail.com \
    --to=magnus.damm@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).