qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Two question on serial port emulation
Date: Wed, 14 Jun 2006 16:05:18 +0200	[thread overview]
Message-ID: <4490179E.7000403@bellard.org> (raw)
In-Reply-To: <A8F9FF3706D1A5479EF62192B976DB44351AE4@pdsmsx401.ccr.corp.intel.com>

Jiang, Yunhong wrote:
> Hi, all
>     I'm using qemu on linux, and I have two questions on the serial port
> emulation. The serial port means the hardware serial port (/dev/ttyS0 on
> Linux).
> 
>     1) Currently tty_serial_init()  set the c_oflags as following:
>         tty.c_oflag |= OPOST
>   but it didn't clear the ONLCR/ONLRET etc. This may cause some problem
> on binary transfer. For example, when transfer "0x0d 0x0a" for "0x0a".
> Following patch may fix this problem, although I'm not sure if we clear
> OPOST, do we still need to clear ONLCR/OCRNL etc bits.
>  
> --- vl.c        2006-05-04 04:32:58.000000000 +0800
> +++ ../qemu-0.8.1_bogus/vl.c    2006-06-01 22:34:09.000000000 +0800
> @@ -1586,7 +1586,8 @@
>  
>      tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
>                            |INLCR|IGNCR|ICRNL|IXON);
> -    tty.c_oflag |= OPOST;
> +    tty.c_oflag &= ~(ONLCR | OCRNL | ONOCR |ONLRET) ;
> +    tty.c_oflag &= ~OPOST;
>      tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
>      tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS);
>      switch(data_bits) {

So forcing all the flags to known values may be even better !

> 2) Currently all write to the serial port will through unix_write().
> Considering : a) if the return value is -EAGAIN, it will not try to
> re-write this again. b) all write will return immetiately. So when guest
> try to write a lot of data continuously, like using zmodem to transfer
> file or using serial port for debugger, it may cause application failure
> (the data is write successfuly from guest point of view, while it failed
> on the host environment). I changed the write process to multi-thread,
> but I don't think it is a good method, so how do you think of these?

You should use the callback based I/Os. An output FIFO must be 
maintained in the serial driver itself. Unfortunately an API is missing 
on the QEMU char devices to do proper asynchronous outputs.

Fabrice.

      reply	other threads:[~2006-06-14 14:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-05  5:17 [Qemu-devel] Two question on serial port emulation Jiang, Yunhong
2006-06-14 14:05 ` Fabrice Bellard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4490179E.7000403@bellard.org \
    --to=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).