qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] serial stdio char drop fix
@ 2004-12-17 19:46 Magnus Damm
  0 siblings, 0 replies; only message in thread
From: Magnus Damm @ 2004-12-17 19:46 UTC (permalink / raw)
  To: qemu-devel

[-- 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-17 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-17 19:46 [Qemu-devel] [PATCH] serial stdio char drop fix Magnus Damm

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).