Skip to content

Commit

Permalink
usb-redir: Change usbredir_open_chardev into usbredir_create_parser
Browse files Browse the repository at this point in the history
As we need to create the parser at more places.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
jwrdegoede authored and kraxel committed Oct 11, 2012
1 parent b4ae3cf commit dbbf019
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions hw/usb/redirect.c
Expand Up @@ -862,15 +862,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());
Expand Down Expand Up @@ -982,7 +978,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");
Expand Down

0 comments on commit dbbf019

Please sign in to comment.