Hi,

On Wed, 31 Jan 2007, Christian MICHON wrote:

> On 1/30/07, Paul Brook <[EMAIL PROTECTED]> wrote:
> > Did you test it? I'm fairly certain it still won't work. AFAICS You're not
> > setting the field anywhere.
> 
> the binary works. The struct statement was missing the "chr". Now, in 
> term of functionality, I do not know how you test it, if this was your 
> question.

You'd have to attach a serial device with "-serial COM". Unfortunately, I 
don't even have "COM" anymore, let alone on a machine which runs Windows, 
so I cannot test either.

But this patch looks sane to me (since WinCharState is initialized by 
win_chr_init(), IMHO it makes sense to pass the CharDriverState to that 
function):

 vl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index 8ddd8ec..7af7d02 100644
--- a/vl.c
+++ b/vl.c
@@ -1875,6 +1875,7 @@ static CharDriverState *qemu_chr_open_pty(void)
 
 #ifdef _WIN32
 typedef struct {
+    CharDriverState *chr;
     int max_size;
     HANDLE hcom, hrecv, hsend;
     OVERLAPPED orecv, osend;
@@ -1916,7 +1917,7 @@ static void win_chr_close(CharDriverState *chr)
     win_chr_close2(s);
 }
 
-static int win_chr_init(WinCharState *s, const char *filename)
+static int win_chr_init(WinCharState *s, CharDriverState *chr, const char 
*filename)
 {
     COMMCONFIG comcfg;
     COMMTIMEOUTS cto = { 0, 0, 0, 0, 0};
@@ -1974,6 +1975,7 @@ static int win_chr_init(WinCharState *s, const char 
*filename)
         fprintf(stderr, "Failed ClearCommError\n");
         goto fail;
     }
+    s->chr = chr;
     qemu_add_polling_cb(win_chr_poll, s);
     return 0;
 
@@ -2086,7 +2088,7 @@ static CharDriverState *qemu_chr_open_win(const char 
*filename)
     chr->chr_write = win_chr_write;
     chr->chr_close = win_chr_close;
 
-    if (win_chr_init(s, filename) < 0) {
+    if (win_chr_init(s, chr, filename) < 0) {
         free(s);
         free(chr);
         return NULL;


_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to