From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHju0-0002S7-86 for qemu-devel@nongnu.org; Sun, 23 Feb 2014 20:00:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHjtu-0007G8-RK for qemu-devel@nongnu.org; Sun, 23 Feb 2014 20:00:12 -0500 Received: from mail-ob0-x22d.google.com ([2607:f8b0:4003:c01::22d]:44350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHjtu-0007Ew-Li for qemu-devel@nongnu.org; Sun, 23 Feb 2014 20:00:06 -0500 Received: by mail-ob0-f173.google.com with SMTP id uz6so6570980obc.4 for ; Sun, 23 Feb 2014 17:00:06 -0800 (PST) Sender: fluxion Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1389778424-4482-2-git-send-email-mmishael@redhat.com> References: <1389778424-4482-1-git-send-email-mmishael@redhat.com> <1389778424-4482-2-git-send-email-mmishael@redhat.com> Message-ID: <20140224010002.3593.23272@loki> Date: Sun, 23 Feb 2014 19:00:02 -0600 Subject: Re: [Qemu-devel] [PATCH V2] qemu-ga: isa-serial support on Windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miki Mishael , qemu-devel@nongnu.org Cc: Yan Vugenfirer , Dmitry Fleytman , Ronen Hod , Anthony Liguori , Adam Litke Quoting Miki Mishael (2014-01-15 03:33:44) > Add support for isa-serial method for qemu-ga on Windows, > Added -p command line parameter for serial port name > specification, e.g. "-p COM15". > = > Signed-off-by: Miki Mishael > Signed-off-by: Dmitry Fleytman Thanks, applied to qga tree: = = https://github.com/mdroth/qemu/commits/qga > --- > qga/channel-win32.c | 20 ++++++++++++++++++-- > qga/main.c | 12 +++++++++--- > 2 files changed, 27 insertions(+), 5 deletions(-) > = > diff --git a/qga/channel-win32.c b/qga/channel-win32.c > index 8a303f3..0d5e5f5 100644 > --- a/qga/channel-win32.c > +++ b/qga/channel-win32.c > @@ -287,12 +287,22 @@ GIOStatus ga_channel_write_all(GAChannel *c, const = char *buf, size_t size) > static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method, > const gchar *path) > { > - if (method !=3D GA_CHANNEL_VIRTIO_SERIAL) { > + COMMTIMEOUTS comTimeOut =3D {0}; > + gchar newpath[MAXPATHLEN] =3D {0}; > + comTimeOut.ReadIntervalTimeout =3D 1; > + > + if (method !=3D GA_CHANNEL_VIRTIO_SERIAL && method !=3D GA_CHANNEL_I= SA_SERIAL) { > g_critical("unsupported communication method"); > return false; > } > = > - c->handle =3D CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, > + if (method =3D=3D GA_CHANNEL_ISA_SERIAL){ > + snprintf(newpath, sizeof(newpath), "\\\\.\\%s", path); > + }else { > + g_strlcpy(newpath, path, sizeof(newpath)); > + } > + > + c->handle =3D CreateFile(newpath, GENERIC_READ | GENERIC_WRITE, 0, N= ULL, > OPEN_EXISTING, > FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED= , NULL); > if (c->handle =3D=3D INVALID_HANDLE_VALUE) { > @@ -300,6 +310,12 @@ static gboolean ga_channel_open(GAChannel *c, GAChan= nelMethod method, > return false; > } > = > + if (method =3D=3D GA_CHANNEL_ISA_SERIAL && !SetCommTimeouts(c->handl= e,&comTimeOut)) { > + g_critical("error setting timeout for com port: %lu",GetLastErro= r()); > + CloseHandle(c->handle); > + return false; > + } > + > return true; > } > = > diff --git a/qga/main.c b/qga/main.c > index c58b26a..c0b09ad 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -47,9 +47,11 @@ > #ifndef _WIN32 > #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.= 0" > #define QGA_STATE_RELATIVE_DIR "run" > +#define QGA_SERIAL_PATH_DEFAULT "/dev/ttyS0" > #else > #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0" > #define QGA_STATE_RELATIVE_DIR "qemu-ga" > +#define QGA_SERIAL_PATH_DEFAULT "COM1" > #endif > #ifdef CONFIG_FSFREEZE > #define QGA_FSFREEZE_HOOK_DEFAULT CONFIG_QEMU_CONFDIR "/fsfreeze-hook" > @@ -659,12 +661,16 @@ static gboolean channel_init(GAState *s, const gcha= r *method, const gchar *path) > } > = > if (path =3D=3D NULL) { > - if (strcmp(method, "virtio-serial") !=3D 0) { > + if (strcmp(method, "virtio-serial") =3D=3D 0 ) { > + /* try the default path for the virtio-serial port */ > + path =3D QGA_VIRTIO_PATH_DEFAULT; > + } else if (strcmp(method, "isa-serial") =3D=3D 0){ > + /* try the default path for the serial port - COM1 */ > + path =3D QGA_SERIAL_PATH_DEFAULT; > + } else { > g_critical("must specify a path for this channel"); > return false; > } > - /* try the default path for the virtio-serial port */ > - path =3D QGA_VIRTIO_PATH_DEFAULT; > } > = > if (strcmp(method, "virtio-serial") =3D=3D 0) { > -- = > 1.8.3.1