From 940bee452cc34127ecf3f364c3c5f52e4e6a80a4 Mon Sep 17 00:00:00 2001 From: gaasedelen Date: Fri, 5 Aug 2022 14:14:23 -0400 Subject: [PATCH] main-loop: Fix QEMU serial debugging on Windows --- chardev/char-win.c | 2 +- util/main-loop.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/chardev/char-win.c b/chardev/char-win.c index d4fb44c4dc..47b14d818b 100644 --- a/chardev/char-win.c +++ b/chardev/char-win.c @@ -110,7 +110,7 @@ int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp) size = sizeof(COMMCONFIG); GetDefaultCommConfig(filename, &comcfg, &size); comcfg.dcb.DCBlength = sizeof(DCB); - CommConfigDialog(filename, NULL, &comcfg); + comcfg.dcb.BaudRate = CBR_115200; if (!SetCommState(s->file, &comcfg.dcb)) { error_setg(errp, "Failed SetCommState"); diff --git a/util/main-loop.c b/util/main-loop.c index f9419212a1..bd732e825a 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -490,16 +490,6 @@ static int os_host_main_loop_wait(int64_t timeout) g_main_context_acquire(context); - /* XXX: need to suppress polling by better using win32 events */ - ret = 0; - for (pe = first_polling_entry; pe != NULL; pe = pe->next) { - ret |= pe->func(pe->opaque); - } - if (ret != 0) { - g_main_context_release(context); - return ret; - } - FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); @@ -562,7 +552,17 @@ static int os_host_main_loop_wait(int64_t timeout) g_main_context_dispatch(context); } + /* XXX: need to suppress polling by better using win32 events */ + ret = 0; + for (pe = first_polling_entry; pe != NULL; pe = pe->next) { + ret |= pe->func(pe->opaque); + } + g_main_context_release(context); + + if (ret != 0) { + return ret; + } return select_ret || g_poll_ret; }