From a3ccbf03b31dfe042e9399a65326148f46f8eeba Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Hans de Goede Date: Mon, 15 Oct 2012 12:46:25 +0200 Subject: [PATCH 3/4] usb-redir: Change usbredir_open_chardev into usbredir_create_parser As we need to create the parser at more places. Signed-off-by: Hans de Goede Upstream commit id: dbbf01958e777b6f03fc4ab425879f84800b9cda Signed-off-by: Michal Novotny --- usb-redir.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index f2cd610..933710d 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -912,15 +912,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 = usbredirparser_create(); @@ -1024,7 +1020,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.11.7