From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LoEoT-0000zU-3a for qemu-devel@nongnu.org; Mon, 30 Mar 2009 06:33:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LoEoO-0000z6-NE for qemu-devel@nongnu.org; Mon, 30 Mar 2009 06:33:52 -0400 Received: from [199.232.76.173] (port=58601 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LoEoO-0000z3-EY for qemu-devel@nongnu.org; Mon, 30 Mar 2009 06:33:48 -0400 Received: from wm34.inbox.com ([64.135.83.34]:3728) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LoEoO-0002mu-0k for qemu-devel@nongnu.org; Mon, 30 Mar 2009 06:33:48 -0400 Received: from inbox.com (127.0.0.1:25) by inbox.com with [InBox.Com SMTP Server] id <903300001264.WM34> for from ; Mon, 30 Mar 2009 1:23:58 AM -0800 Mime-Version: 1.0 Date: Mon, 30 Mar 2009 01:23:58 -0800 Message-ID: From: Dietrich Lauter Subject: [Qemu-devel] Bug report: Windows and serial port lager than COM9 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, I run into a smaller bug using QEMU (0.10.1) on Windows. I was able to = track down the issue and also found a solution. I want to share with you = this fix. I hope I did it in the proper way, so you might integrate it. Solution: I made a change in the function =22win_chr_init(...)=22 of the source file = =22qemu-char.c=22 . I took parts from the function = =22win_chr_pipe_init(...)=22 to implement the fix, as a pipe needs to be = open using a similar name format than for serial ports larger than COM9. The output of the a diff looks like the following: =24 diff qemu-char.c.ORG qemu-char.c =20 1389a1390 > char openname=5B256=5D; 1402c1403,1404 < s->hcom =3D CreateFile(filename, GENERIC_READ=7CGENERIC_WRITE, 0, = NULL, --- > snprintf(openname, sizeof(openname), =22=5C=5C=5C=5C.=5C=5C%s=22, = filename); > s->hcom =3D CreateFile(openname, GENERIC_READ=7CGENERIC_WRITE, 0, = NULL, Background: I had tested the ARM-Emulator from QEMU using the parameter =22-serial=22 = to connect to one of my virutal serial ports (com0com). The port, I wanted = to use, has the name =22COM50:=22. When I started the emulator using = command =22qemu-system-arm ... -serial COM50=22 I got the following error = message: Failed CreateFile (2) qemu: could not open serial device 'COM50' Reading the definition for the CreateFile function, I saw that for serial = ports lager than COM9 the format of FileName should be in a specific = format e.g. =22=5C=5C.=5CCOM10=22. This specific handling is also = described in the following article: HOWTO: Specify Serial Ports Larger than COM9 = (http://support.microsoft.com/kb/115831) Kind regards, Dietrich PS: That's my first posting ... so please let me known if I was doing = something wrong. =3D=3D=3D (new) qemu-char.c =3D=3D=3D =2E.. static int win_chr_init(CharDriverState *chr, const char *filename) =7B WinCharState *s =3D chr->opaque; COMMCONFIG comcfg; COMMTIMEOUTS cto =3D =7B 0, 0, 0, 0, 0=7D; COMSTAT comstat; DWORD size; DWORD err; char openname=5B256=5D; s->hsend =3D CreateEvent(NULL, TRUE, FALSE, NULL); if (=21s->hsend) =7B fprintf(stderr, =22Failed CreateEvent=5Cn=22); goto fail; =7D s->hrecv =3D CreateEvent(NULL, TRUE, FALSE, NULL); if (=21s->hrecv) =7B fprintf(stderr, =22Failed CreateEvent=5Cn=22); goto fail; =7D snprintf(openname, sizeof(openname), =22=5C=5C=5C=5C.=5C=5C%s=22, = filename); s->hcom =3D CreateFile(openname, GENERIC_READ=7CGENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); =2E..