diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-10-18 20:42:23 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-11-19 10:25:12 +0100 |
commit | c5273022a1c87778408ae60cd5bba62f9b6e2a32 (patch) | |
tree | 27a1bb84557c4bb181a9dfc3404ba7934e91aeba | |
parent | 980b904bc062d22a02a845ba67e0d08aead26b83 (diff) |
usbredirhost_cancel_pending_urbs: Add a notify_guest parameter
If this is 1 then the guest will be send stream_status packets with
a status of usb_redir_stall for any stopped streams.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | usbredirhost/usbredirhost.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c index 4ec8aca..6d361d2 100644 --- a/usbredirhost/usbredirhost.c +++ b/usbredirhost/usbredirhost.c @@ -219,7 +219,8 @@ static void LIBUSB_CALL usbredirhost_iso_packet_complete( struct libusb_transfer *libusb_transfer); static void LIBUSB_CALL usbredirhost_buffered_packet_complete( struct libusb_transfer *libusb_transfer); -static int usbredirhost_cancel_pending_urbs(struct usbredirhost *host); +static int usbredirhost_cancel_pending_urbs(struct usbredirhost *host, + int notify_guest); static void usbredirhost_wait_for_cancel_completion(struct usbredirhost *host); static void usbredirhost_clear_device(struct usbredirhost *host); @@ -820,7 +821,7 @@ static void usbredirhost_clear_device(struct usbredirhost *host) if (!host->dev) return; - if (usbredirhost_cancel_pending_urbs(host)) + if (usbredirhost_cancel_pending_urbs(host, 0)) usbredirhost_wait_for_cancel_completion(host); usbredirhost_release(host, 1); @@ -1243,13 +1244,16 @@ static void usbredirhost_clear_stream_stall_unlocked( /**************************************************************************/ /* Called from close and parser read callbacks */ -static int usbredirhost_cancel_pending_urbs(struct usbredirhost *host) +static int usbredirhost_cancel_pending_urbs(struct usbredirhost *host, + int notify_guest) { struct usbredirtransfer *t; int i, wait; LOCK(host); for (i = 0; i < MAX_ENDPOINTS; i++) { + if (notify_guest && host->endpoint[i].transfer_count) + usbredirhost_send_stream_status(host, 0, I2EP(i), usb_redir_stall); usbredirhost_cancel_stream_unlocked(host, I2EP(i)); } @@ -1260,6 +1264,9 @@ static int usbredirhost_cancel_pending_urbs(struct usbredirhost *host) } UNLOCK(host); + if (notify_guest) + FLUSH(host); + return wait; } @@ -1568,7 +1575,7 @@ static void usbredirhost_set_configuration(void *priv, uint64_t id, host->reset = 0; - usbredirhost_cancel_pending_urbs(host); + usbredirhost_cancel_pending_urbs(host, 0); usbredirhost_release(host, 0); r = libusb_set_configuration(host->handle, set_config->configuration); |