From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um29I-00071Y-7G for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um29E-00072E-9l for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:28:40 -0400 Received: from mail-bk0-x22e.google.com ([2a00:1450:4008:c01::22e]:36924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um29E-00071u-3a for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:28:36 -0400 Received: by mail-bk0-f46.google.com with SMTP id na10so3315286bkb.33 for ; Mon, 10 Jun 2013 06:28:35 -0700 (PDT) From: Peter Wu Date: Mon, 10 Jun 2013 15:28:32 +0200 Message-ID: <4881344.H8WkShJ958@al> In-Reply-To: <51B5CD5F.5090602@redhat.com> References: <4543955.Y102znvq4W@al> <1840622.xrNe1LmldJ@al> <51B5CD5F.5090602@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [Qemu-devel] [PATCH] chardev: add baud parameter for serial host device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Anthony Liguori , qemu-devel@nongnu.org On Monday 10 June 2013 14:58:07 Gerd Hoffmann wrote: > On 06/10/13 10:42, Peter Wu wrote: > > On Monday 10 June 2013 07:56:01 Gerd Hoffmann wrote: > >> On 06/08/13 23:49, Peter Wu wrote: > >>> When QEMU starts, it always changes the serial port parameters including > >>> baud rate. This confused my guest which thought it was outputting at > >>> 9600 > >>> baud while it was in fact changed to 115200. > >>> > >>> > >>> > >>> After this patch, I can use `-serial /dev/ttyS0,baud=9600` to override > >>> the > >>> default baud rate of 115200. > >> > >> I think we should just flip the default to 9600. IIRC this is the > >> power-on default baud rate of the 8250 uart family, so this should be > >> the qemu default too. If a guest wants to use a higher baudrate it has > >> to reprogram the uart anyway (and qemu will apply the guest changes to > >> the host uart). > > > > > > > > FWIW, when I tried MODE.COM in ms-dos to change the baud rate, `stty -F > > /dev/ttyS0 -a` still reported 115200 baud. This is on Linux 3.9 if that > > matters. > > Hmm, with a linux guest changing the baudrate works just fine. Any > chance mode.com takes a shortcut in case it thinks the rate didn't > change? Does setting the speed first to 4800, then to 9600 work? I can confirm that a Linux guest can correctly control the speed. At home I only have a USB serial, but that shouldn't matter. 1. stty -F /dev/ttyUSB0 reports 9600 2. Start QEMU using: qemu-system-x86_64 -enable-kvm -m 1G -serial /dev/ttyUSB0 \ -cdrom ubuntu-12.04.1-desktop-amd64.iso 3. stty -F /dev/ttyUSB0 reports 115200 before booting the live CD 4. After boot, both the guest and host report 9600 again 5. Changing it using stty -F /dev/ttyS0 from the guest is also visible on both sides. On ms-dos I observe with 1.4.1 and 1.5.0 that the baud rate *is* changed correctly with my USB serial converter. I will have to check with the serial printer again whether I made a mistake before. I did actually have to use `stty -F /dev/ttyS0 raw 9600` to avoid characters being eaten which caused the serial printer to spit out empty lines or hang. Regards, Peter > > Besides this comment, any other feedback on the patch itself? > > Style is fine. But it appears to paper over some bug, and I'd prefer to > find+fix the bug instead of allowing/requiring the user to set the baud > rate manually to the correct value.