qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Somebody improving serial emulation?


From: Juergen Pfennig
Subject: [Qemu-devel] Somebody improving serial emulation?
Date: Thu, 12 Jan 2006 12:41:47 +0100
User-agent: KMail/1.7.2

Hi,
I could not continue with my documentation (using qemu with Win2003) because I 
could not
make a Towitoku serial card reader work. With the original qemu 8.0 it failed 
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 did 
the following
changes (serial.c and vl.c):

(1) divider must be 16 bit, not 8 bit. To handle the state file I changed the 
version from 1 to 2.
      The serial_load code can be changed to something like ...

    if(version_id == 1)
        s->divider = qemu_get_byte(f);
    else if(version_id == 2)
        s->divider = 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 ...

     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) == 0)
                break;
            // don't care about pending interrupt ...
            if(errno == 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=1 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 |= 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 not 
work and 
that I have no other devices for testing (or not cables) any longer.

Tell me what to do.

Yours Jürgen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]