Blame SOURCES/0016-usb-backend-Fix-spice-usbredir-redirect-on-connect-o.patch

7492b2
From afc5872bff1eb327dd299bacdc4eec5e26d37a10 Mon Sep 17 00:00:00 2001
7492b2
From: Frediano Ziglio <freddy77@gmail.com>
7492b2
Date: Wed, 23 Sep 2020 17:05:01 +0100
7492b2
Subject: [PATCH] usb-backend: Fix spice-usbredir-redirect-on-connect option
7492b2
7492b2
After commit 3e20f17b90598e740c4e274b81d99f28187da800 (cfr
7492b2
"usb-redir: extend USB backend to support emulated devices")
7492b2
this option stopped working, as devices are not redirected.
7492b2
Data for device to guest were not written during initialisation.
7492b2
7492b2
With this fix both spice-usbredir-redirect-on-connect and
7492b2
spice-share-cd are working (even together).
7492b2
7492b2
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1874740.
7492b2
7492b2
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
7492b2
Acked-by: Uri Lublin <uril@redhat.com>
7492b2
---
7492b2
 src/usb-backend.c | 2 +-
7492b2
 1 file changed, 1 insertion(+), 1 deletion(-)
7492b2
7492b2
diff --git a/src/usb-backend.c b/src/usb-backend.c
7492b2
index a4a5f0a..857488e 100644
7492b2
--- a/src/usb-backend.c
7492b2
+++ b/src/usb-backend.c
7492b2
@@ -418,7 +418,7 @@ static void usbredir_write_flush_callback(void *user_data)
7492b2
         return;
7492b2
     }
7492b2
     if (is_channel_ready(ch->usbredir_channel)) {
7492b2
-        if (ch->state == USB_CHANNEL_STATE_HOST) {
7492b2
+        if (ch->state != USB_CHANNEL_STATE_PARSER && ch->usbredirhost != NULL) {
7492b2
             SPICE_DEBUG("%s ch %p -> usbredirhost", __FUNCTION__, ch);
7492b2
             usbredirhost_write_guest_data(ch->usbredirhost);
7492b2
         } else {
7492b2
-- 
7492b2
2.28.0
7492b2