And also switch to using usb_ep_set_pipeline(), rather then modifying the ep directly.
This is a preparation patch for adding input queuing support. Signed-off-by: Hans de Goede <hdego...@redhat.com> --- configure | 2 +- hw/usb/redirect.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 248b871..036c38a 100755 --- a/configure +++ b/configure @@ -2768,7 +2768,7 @@ fi # check for usbredirparser for usb network redirection support if test "$usb_redir" != "no" ; then - if $pkg_config --atleast-version=0.5 libusbredirparser-0.5 >/dev/null 2>&1 ; then + if $pkg_config --atleast-version=0.5.3 libusbredirparser-0.5 >/dev/null 2>&1 ; then usb_redir="yes" usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null) usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index ae7393f..19fe00b 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -585,6 +585,10 @@ static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p, bulk_packet.endpoint = ep; bulk_packet.length = p->iov.size; bulk_packet.stream_id = 0; + bulk_packet.length_high = p->iov.size >> 16; + assert(bulk_packet.length_high == 0 || + usbredirparser_peer_has_cap(dev->parser, + usb_redir_cap_32bits_bulk_length)); if (ep & USB_DIR_IN) { usbredirparser_send_bulk_packet(dev->parser, p->id, @@ -906,6 +910,7 @@ static void usbredir_create_parser(USBRedirDevice *dev) usbredirparser_caps_set_cap(caps, usb_redir_cap_filter); usbredirparser_caps_set_cap(caps, usb_redir_cap_ep_info_max_packet_size); usbredirparser_caps_set_cap(caps, usb_redir_cap_64bits_ids); + usbredirparser_caps_set_cap(caps, usb_redir_cap_32bits_bulk_length); if (runstate_check(RUN_STATE_INMIGRATE)) { flags |= usbredirparser_fl_no_hello; @@ -1302,7 +1307,7 @@ static void usbredir_ep_info(void *priv, { USBRedirDevice *dev = priv; struct USBEndpoint *usb_ep; - int i; + int i, pid; for (i = 0; i < MAX_ENDPOINTS; i++) { dev->endpoint[i].type = ep_info->type[i]; @@ -1339,7 +1344,16 @@ static void usbredir_ep_info(void *priv, usb_ep->max_packet_size = ep_info->max_packet_size[i]; } if (ep_info->type[i] == usb_redir_type_bulk) { - usb_ep->pipeline = true; + if (i & 0x10) { + if (!usbredirparser_peer_has_cap(dev->parser, + usb_redir_cap_32bits_bulk_length)) { + continue; /* No input pipeline without 32 bits length! */ + } + pid = USB_TOKEN_IN; + } else { + pid = USB_TOKEN_OUT; + } + usb_ep_set_pipeline(&dev->dev, pid, i & 0x0f, true); } } } @@ -1471,7 +1485,7 @@ static void usbredir_bulk_packet(void *priv, uint64_t id, { USBRedirDevice *dev = priv; uint8_t ep = bulk_packet->endpoint; - int len = bulk_packet->length; + int len = (bulk_packet->length_high << 16) | bulk_packet->length; USBPacket *p; DPRINTF("bulk-in status %d ep %02X len %d id %"PRIu64"\n", -- 1.7.12.1