Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:sschapiro:openstack:upstream
qemu
0011-usb-redir-Add-flow-control-support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0011-usb-redir-Add-flow-control-support.patch of Package qemu
>From e7903f889f3105efe7e3876925926e8e91919b0f Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> Date: Tue, 19 Jul 2011 10:56:19 +0200 Subject: [PATCH 11/28] usb-redir: Add flow control support Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- usb-redir.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e2b5a2c..6932beb 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -224,8 +224,22 @@ static int usbredir_read(void *priv, uint8_t *data, int count) static int usbredir_write(void *priv, uint8_t *data, int count) { USBRedirDevice *dev = priv; + int r; - return qemu_chr_write(dev->cs, data, count); + if (dev->cs->write_blocked) { + return 0; + } + + r = qemu_chr_write(dev->cs, data, count); + + if (r < 0) { + if (dev->cs->write_blocked) { + return 0; + } + return -1; + } + + return r; } /* @@ -782,10 +796,22 @@ static void usbredir_chardev_event(void *opaque, int event) } } +static void usbredir_chardev_write_unblocked(void *opaque) +{ + USBRedirDevice *dev = opaque; + + if (dev->parser == NULL) { + /* usbredir_open_close_bh hasn't handled the open event yet */ + return; + } + usbredirparser_do_write(dev->parser); +} + static const QemuChrHandlers usbredir_chr_handlers = { .fd_can_read = usbredir_chardev_can_read, .fd_read = usbredir_chardev_read, .fd_event = usbredir_chardev_event, + .fd_write_unblocked = usbredir_chardev_write_unblocked, }; /* -- 1.7.5.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor