* [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser
@ 2012-09-27 15:25 Hans de Goede
2012-09-27 15:25 ` [Qemu-devel] [PATCH 2/2] usb-redir: Don't make migration fail in none seamless case Hans de Goede
2012-10-08 14:10 ` [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Gerd Hoffmann
0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2012-09-27 15:25 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Hans de Goede, qemu-devel
As we need to create the parser at more places.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/usb/redirect.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 78e93a7..5d16aff 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -872,15 +872,11 @@ static void usbredir_chardev_close_bh(void *opaque)
}
}
-static void usbredir_chardev_open(USBRedirDevice *dev)
+static void usbredir_create_parser(USBRedirDevice *dev)
{
uint32_t caps[USB_REDIR_CAPS_SIZE] = { 0, };
int flags = 0;
- /* Make sure any pending closes are handled (no-op if none pending) */
- usbredir_chardev_close_bh(dev);
- qemu_bh_cancel(dev->chardev_close_bh);
-
DPRINTF("creating usbredirparser\n");
dev->parser = qemu_oom_check(usbredirparser_create());
@@ -992,7 +988,10 @@ static void usbredir_chardev_event(void *opaque, int event)
switch (event) {
case CHR_EVENT_OPENED:
DPRINTF("chardev open\n");
- usbredir_chardev_open(dev);
+ /* Make sure any pending closes are handled (no-op if none pending) */
+ usbredir_chardev_close_bh(dev);
+ qemu_bh_cancel(dev->chardev_close_bh);
+ usbredir_create_parser(dev);
break;
case CHR_EVENT_CLOSED:
DPRINTF("chardev close\n");
--
1.7.12
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/2] usb-redir: Don't make migration fail in none seamless case
2012-09-27 15:25 [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Hans de Goede
@ 2012-09-27 15:25 ` Hans de Goede
2012-10-08 14:10 ` [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2012-09-27 15:25 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Hans de Goede, qemu-devel
Instead simple disconnect the device like host redirection does on
migration.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/usb/redirect.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 5d16aff..022ba42 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1637,12 +1637,17 @@ static int usbredir_get_parser(QEMUFile *f, void *priv, size_t unused)
}
/*
- * Our chardev should be open already at this point, otherwise
- * the usbredir channel will be broken (ie spice without seamless)
+ * If our chardev is not open already at this point the usbredir connection
+ * has been broken (non seamless migration, or restore from disk).
+ *
+ * In this case create a temporary parser to receive the migration data,
+ * and schedule the close_bh to report the device as disconnected to the
+ * guest and to destroy the parser again.
*/
if (dev->parser == NULL) {
- ERROR("get_parser called with closed chardev, failing migration\n");
- return -1;
+ WARNING("usb-redir connection broken during migration\n");
+ usbredir_create_parser(dev);
+ qemu_bh_schedule(dev->chardev_close_bh);
}
data = g_malloc(len);
--
1.7.12
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser
2012-09-27 15:25 [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Hans de Goede
2012-09-27 15:25 ` [Qemu-devel] [PATCH 2/2] usb-redir: Don't make migration fail in none seamless case Hans de Goede
@ 2012-10-08 14:10 ` Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2012-10-08 14:10 UTC (permalink / raw)
To: Hans de Goede; +Cc: qemu-devel
On 09/27/12 17:25, Hans de Goede wrote:
> As we need to create the parser at more places.
Both patches added to usb patch queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-08 14:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27 15:25 [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Hans de Goede
2012-09-27 15:25 ` [Qemu-devel] [PATCH 2/2] usb-redir: Don't make migration fail in none seamless case Hans de Goede
2012-10-08 14:10 ` [Qemu-devel] [PATCH 1/2] usb-redir: Change usbredir_open_chardev into usbredir_create_parser Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).