Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ex24l-0007QG-Cc for qemu-devel@nongnu.org; Thu, 12 Jan 2006 08:01:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ex20g-0006YO-1j for qemu-devel@nongnu.org; Thu, 12 Jan 2006 07:57:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ex0sE-00016i-RK for qemu-devel@nongnu.org; Thu, 12 Jan 2006 06:44:13 -0500 Received: from [212.227.126.171] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ex0v1-0008Sx-N3 for qemu-devel@nongnu.org; Thu, 12 Jan 2006 06:47:04 -0500 Received: from alpha9.centauri.home ([10.21.2.7]) by alpha0.centauri.home with esmtp (Exim 4.54) id 1Ex0pw-0006xu-R5 for qemu-devel@nongnu.org; Thu, 12 Jan 2006 12:41:48 +0100 From: Juergen Pfennig Date: Thu, 12 Jan 2006 12:41:47 +0100 References: <0MKpdM-1Ewosi0K2f-0002cQ@mx.kundenserver.de> In-Reply-To: <0MKpdM-1Ewosi0K2f-0002cQ@mx.kundenserver.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200601121241.47329.info@j-pfennig.de> Subject: [Qemu-devel] Somebody improving serial emulation? 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 could not continue with my documentation (using qemu with Win2003) becaus= e I could not make a Towitoku serial card reader work. With the original qemu 8.0 it fail= ed to work badly, after some patches it now fails much nicer (they seem to use a combination = of BREAK and DSR in their ASIC to switch between Mouse passthrough and card-reader). I d= id the following changes (serial.c and vl.c): (1) divider must be 16 bit, not 8 bit. To handle the state file I changed t= he version from 1 to 2. The serial_load code can be changed to something like ... if(version_id =3D=3D 1) s->divider =3D qemu_get_byte(f); else if(version_id =3D=3D 2) s->divider =3D qemu_get_be16(f); else return -EINVAL; Is such backward compatibility welcome? (2) I changed serial_load to restore the linux-side serial device settings = =2E.. serial_update_parameters(s); Is such behaviour intended? (3) I removed redundant calls to tty_serial_init. (4) I improved the handling of BREAK in vl.c tty_serial_ioctl ... #if defined(TIOCSBRK) && !defined(_WIN32) // Linux should use TIOCSBRK and TIOCCBRK if(ioctl(s->fd_in, enable ? TIOCSBRK : TIOCCBRK) =3D=3D 0) break; // don't care about pending interrupt ... if(errno =3D=3D EINTR) break; perror("CHR_IOCTL_SERIAL_SET_BREAK fallback to tcsendbreak()"); #endif By the way: the qemu 8.0 code causes Linux to send 100ms breaks, which= is probably not what is intended (I looked it up in kernel code)... // here arg=3D1 is used and in the linux tty driver the code is: // send_break(tty, arg ? arg*100 : 250); if (enable) // Linux should use 0, 3, 4 or even 5 but not 1 here ... tcsendbreak(s->fd_in, 1); (5) I added support for a second stop bit (bug-fix) vl.c tty_serial_init ... if(stop_bits > 1) tty.c_cflag |=3D CSTOPB; switch(parity) { I have no idea if somebody else has already made similar patches and/or if = patches from my side would be welcome. I have to admit that my card-reader still does no= t work and=20 that I have no other devices for testing (or not cables) any longer. Tell me what to do. Yours J=FCrgen