diff --git a/0001-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch b/0001-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch new file mode 100644 index 0000000..f0c210d --- /dev/null +++ b/0001-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch @@ -0,0 +1,47 @@ +From 7783d3db61083bbf7f61b1ea8608c666b4c6a1dd Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 22 Jun 2012 11:48:37 +0200 +Subject: [PATCH 1/5] usbredirhost: Don't set a timeout on bulk transfers + +Bulk packets can be (ab)used as interrupt transfers without timing guarantees, +iow you can submit a bulk in transfer and let it be submitted until the +device has data to reports a few eons later. + +This is used by (some?) USB cdc-acm devices (modems, smartcard readers, gps +devices), specifically a smartcard reader I've been debugging, which currently +does not work. + +Not setting a timeout at the usb-host side fixes these devices. For devices +where timeouts do make sense, the timeouts should be handled by the usb-guest, +which has device specific knowledge we lack. + +Signed-off-by: Hans de Goede +--- + usbredirhost/usbredirhost.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c +index 8b0c1ba..be75f87 100644 +--- a/usbredirhost/usbredirhost.c ++++ b/usbredirhost/usbredirhost.c +@@ -31,7 +31,7 @@ + #define MAX_ENDPOINTS 32 + #define MAX_INTERFACES 32 /* Max 32 endpoints and thus interfaces */ + #define CTRL_TIMEOUT 5000 /* USB specifies a 5 second max timeout */ +-#define BULK_TIMEOUT 5000 ++#define BULK_TIMEOUT 0 /* No timeout for bulk transfers */ + #define ISO_TIMEOUT 1000 + #define INTERRUPT_TIMEOUT 0 /* No timeout for interrupt transfers */ + +@@ -2017,7 +2017,7 @@ static void usbredirhost_bulk_packet(void *priv, uint32_t id, + libusb_fill_bulk_transfer(transfer->transfer, host->handle, ep, + data, bulk_packet->length, + usbredirhost_bulk_packet_complete, +- transfer, CTRL_TIMEOUT); ++ transfer, BULK_TIMEOUT); + transfer->id = id; + transfer->bulk_packet = *bulk_packet; + +-- +1.7.11.2 + diff --git a/0002-usbredirhost-Properly-log-an-error-when-the-initial-.patch b/0002-usbredirhost-Properly-log-an-error-when-the-initial-.patch new file mode 100644 index 0000000..944ecb6 --- /dev/null +++ b/0002-usbredirhost-Properly-log-an-error-when-the-initial-.patch @@ -0,0 +1,36 @@ +From cb74b3113076d6e18c799a0c73978e1aea32bad0 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 6 Jul 2012 14:25:48 +0200 +Subject: [PATCH 2/5] usbredirhost: Properly log an error when the initial + device reset fails + +Signed-off-by: Hans de Goede +--- + TODO | 1 + + usbredirhost/usbredirhost.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/TODO b/TODO +index e6715b1..2085006 100644 +--- a/TODO ++++ b/TODO +@@ -4,3 +4,4 @@ + * cancel pending packets / active streams before reset? + * add a queue_buf call to parser, use it in host to avoid memcpy of + "in" bulk transfers ++* use libusb strerror equivalent instead of numeric error codes in logs +diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c +index be75f87..2415c26 100644 +--- a/usbredirhost/usbredirhost.c ++++ b/usbredirhost/usbredirhost.c +@@ -707,6 +707,7 @@ int usbredirhost_set_device(struct usbredirhost *host, + so lets do that before hand */ + r = libusb_reset_device(host->handle); + if (r != 0) { ++ ERROR("resetting device: %d", r); + usbredirhost_clear_device(host); + return libusb_status_or_error_to_redir_status(host, r); + } +-- +1.7.11.2 + diff --git a/usbredir.spec b/usbredir.spec index 42bff7f..e124222 100644 --- a/usbredir.spec +++ b/usbredir.spec @@ -1,11 +1,13 @@ Name: usbredir Version: 0.4.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: USB network redirection protocol libraries Group: System Environment/Libraries License: LGPLv2+ URL: http://spice-space.org/page/UsbRedir Source0: http://spice-space.org/download/%{name}/%{name}-%{version}.tar.bz2 +Patch1: 0001-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch +Patch2: 0002-usbredirhost-Properly-log-an-error-when-the-initial-.patch BuildRequires: libusb1-devel >= 1.0.9 %description @@ -45,6 +47,8 @@ A simple USB host TCP server, using libusbredirhost. %prep %setup -q +%patch1 -p1 +%patch2 -p1 %build @@ -62,25 +66,25 @@ rm $RPM_BUILD_ROOT%{_libdir}/libusbredir*.la %files -%defattr(-,root,root,-) %doc ChangeLog COPYING.LIB README TODO %{_libdir}/libusbredir*.so.* %files devel -%defattr(-,root,root,-) %doc usb-redirection-protocol.txt README.multi-thread %{_includedir}/usbredir*.h %{_libdir}/libusbredir*.so %{_libdir}/pkgconfig/libusbredir*.pc %files server -%defattr(-,root,root,-) %doc COPYING %{_sbindir}/usbredirserver %{_mandir}/man1/usbredirserver.1* %changelog +* Mon Jul 30 2012 Hans de Goede - 0.4.3-3 +- Add 2 fixes from upstream fixing issues with some bulk devices (rhbz#842358) + * Sun Jul 22 2012 Fedora Release Engineering - 0.4.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild