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

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