msmouse: fix buffer handling
commit57a4e3b92b6e87158c1e5192fb99a5ac3b82dd5a
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 4 Jul 2016 09:42:53 +0000 (4 11:42 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 12 Jul 2016 07:24:31 +0000 (12 09:24 +0200)
treeb30fb1ce19e7243ec2367b0804684cf32cb5f4dd
parentcde8dcbc926d9b960a96c7d637b9c23515e06c0b
msmouse: fix buffer handling

The msmouse chardev backend writes data without checking whenever there
is enough space.

That happens to work with linux guests, probably by pure luck because
the linux driver enables the fifo and the serial port emulation accepts
more data than announced via qemu_chr_be_can_write() in that case.

Handle this properly by adding a buffer to MouseState.  Hook up a
CharDriverState->accept_input() handler which feeds the buffer to the
serial port.  msmouse_event() only fills the buffer now, and calls the
accept_input handler too to kick off the transmission.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1467625375-31774-3-git-send-email-kraxel@redhat.com
backends/msmouse.c