diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08a3262 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/usbredir-0.7.1.tar.bz2 diff --git a/.usbredir.metadata b/.usbredir.metadata new file mode 100644 index 0000000..8b685aa --- /dev/null +++ b/.usbredir.metadata @@ -0,0 +1 @@ +baa5d8fcdb3246052fbfac86aee750ae8d33c4fd SOURCES/usbredir-0.7.1.tar.bz2 diff --git a/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch b/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch new file mode 100644 index 0000000..8d7c849 --- /dev/null +++ b/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch @@ -0,0 +1,84 @@ +From 086ececd5f7f6bd8668f11d8811bf8badb9d8c5d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Tue, 3 Nov 2015 10:35:22 +0100 +Subject: [PATCH] usbredirhost: Fix -Wformat warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use "PRIu64" macro for printf-ing uint64_t variables, avoiding warnings +like: +usbredirhost.c: In function 'usbredirhost_can_write_iso_package': +usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c: In function 'usbredirhost_set_iso_threshold': +usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + +Signed-off-by: Fabiano FidĂȘncio +--- + usbredirhost/usbredirhost.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c +index adf9c5f..83baa3b 100644 +--- a/usbredirhost/usbredirhost.c ++++ b/usbredirhost/usbredirhost.c +@@ -1020,12 +1020,12 @@ static int usbredirhost_can_write_iso_package(struct usbredirhost *host) + size = host->buffered_output_size_func(host->func_priv); + if (size >= host->iso_threshold.higher) { + if (!host->iso_threshold.dropping) +- DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", ++ DEBUG("START dropping isoc packets %" PRIu64 " buffer > %" PRIu64 " hi threshold", + size, host->iso_threshold.higher); + host->iso_threshold.dropping = true; + } else if (size < host->iso_threshold.lower) { + if (host->iso_threshold.dropping) +- DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", ++ DEBUG("STOP dropping isoc packets %" PRIu64 " buffer < %" PRIu64 " low threshold", + size, host->iso_threshold.lower); + + host->iso_threshold.dropping = false; +@@ -1159,7 +1159,7 @@ static void usbredirhost_set_iso_threshold(struct usbredirhost *host, + uint64_t reference = pkts_per_transfer * transfer_count * max_packetsize; + host->iso_threshold.lower = reference / 2; + host->iso_threshold.higher = reference * 3; +- DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", ++ DEBUG("higher threshold is %" PRIu64 " bytes | lower threshold is %" PRIu64 " bytes", + host->iso_threshold.higher, host->iso_threshold.lower); + } + +-- +2.5.5 + diff --git a/SOURCES/0002-Don-t-print-warning-when-resetting-a-missing-device.patch b/SOURCES/0002-Don-t-print-warning-when-resetting-a-missing-device.patch new file mode 100644 index 0000000..2f110c3 --- /dev/null +++ b/SOURCES/0002-Don-t-print-warning-when-resetting-a-missing-device.patch @@ -0,0 +1,42 @@ +From 39aa3c69f61bba28856a3eef3fe4ab37a3968e88 Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Thu, 10 Aug 2017 10:41:57 -0500 +Subject: [PATCH usbredir] Don't print warning when resetting a missing device + +When usbredirhost clears the current device, it resets the device and +attempts to re-attach the kernel driver for the device. The current +device is cleared when the API user explicitly sets a new device with +usbredirhost_set_device(). However, some API users call +usbredirhost_set_device(..., NULL) to clear the current device when the +redirected device has been unplugged. In this scenario, resetting the +device will fail and print a warning to the terminal. Since this is an +expected scenario, we should simply handle it rather than printing an +warning. + +Resolves: rhbz#1442963 +Signed-off-by: Jonathon Jongsma +Acked-by: Frediano Ziglio +--- + usbredirhost/usbredirhost.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c +index a6bf8b3..3666227 100644 +--- a/usbredirhost/usbredirhost.c ++++ b/usbredirhost/usbredirhost.c +@@ -604,7 +604,11 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers) + if (!(host->quirks & QUIRK_DO_NOT_RESET)) { + r = libusb_reset_device(host->handle); + if (r != 0) { +- ERROR("error resetting device: %s", libusb_error_name(r)); ++ /* if we're releasing the device because it was removed, resetting ++ * will fail. Don't print a warning in this situation */ ++ if (r != LIBUSB_ERROR_NO_DEVICE) { ++ ERROR("error resetting device: %s", libusb_error_name(r)); ++ } + return; + } + } +-- +2.13.6 + diff --git a/SPECS/usbredir.spec b/SPECS/usbredir.spec new file mode 100644 index 0000000..75087cc --- /dev/null +++ b/SPECS/usbredir.spec @@ -0,0 +1,165 @@ +Name: usbredir +Version: 0.7.1 +Release: 3%{?dist} +Summary: USB network redirection protocol libraries +Group: System Environment/Libraries +License: LGPLv2+ +URL: https://www.spice-space.org +Source0: https://www.spice-space.org/download/%{name}/%{name}-%{version}.tar.bz2 +# Some patches from upstream git (drop at next rebase) +Patch1: 0001-usbredirhost-Fix-Wformat-warning.patch +Patch2: 0002-Don-t-print-warning-when-resetting-a-missing-device.patch +BuildRequires: libusb1-devel >= 1.0.20 + +%description +The usbredir libraries allow USB devices to be used on remote and/or virtual +hosts over TCP. The following libraries are provided: + +usbredirparser: +A library containing the parser for the usbredir protocol + +usbredirhost: +A library implementing the USB host side of a usbredir connection. +All that an application wishing to implement a USB host needs to do is: +* Provide a libusb device handle for the device +* Provide write and read callbacks for the actual transport of usbredir data +* Monitor for usbredir and libusb read/write events and call their handlers + + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + +%package server +Summary: Simple USB host TCP server +Group: System Environment/Daemons +License: GPLv2+ +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description server +A simple USB host TCP server, using libusbredirhost. + + +%prep +%setup -q +%patch1 -p1 +%patch2 -p1 + + +%build +%configure --disable-static +make %{?_smp_mflags} V=1 + + +%install +%make_install +rm $RPM_BUILD_ROOT%{_libdir}/libusbredir*.la + + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + + +%files +%doc ChangeLog COPYING.LIB README TODO +%{_libdir}/libusbredir*.so.* + +%files devel +%doc usb-redirection-protocol.txt README.multi-thread +%{_includedir}/usbredir*.h +%{_libdir}/libusbredir*.so +%{_libdir}/pkgconfig/libusbredir*.pc + +%files server +%doc COPYING +%{_sbindir}/usbredirserver +%{_mandir}/man1/usbredirserver.1* + + +%changelog +* Fri Nov 17 2017 Jonathon Jongsma - 0.7.1-3 +- Don't print a warning when resetting a removed device + Resolves: rhbz#1442963 + +* Tue Dec 20 2016 Pavel Grunt - 0.7.1-2 +- Rebuild to add USB3 support + Resolves: rhbz#976685 + +* Wed Jun 8 2016 Victor Toso - 0.7.1-1 +- Rebase to latest upstream: 0.7.1 + Resolves: rhbz#1033101 + +* Mon Feb 29 2016 Victor Toso - 0.6-8 +- Fix migration due lack of capabilities from source host + Resolves: rhbz#1185167 +- New callback to drop isoc packets in order to avoid high memory + consumption in the client + Resolves: rhbz#1312913 + +* Fri Jan 24 2014 Daniel Mach - 0.6-7 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 0.6-6 +- Mass rebuild 2013-12-27 + +* Tue Sep 10 2013 Hans de Goede - 0.6-5 +- Use the new libusb autodetach kernel driver functionality +- Fix a usbredirparser bug which causes tcp/ip redir to not work (rhbz#1005015) + +* Sun Aug 04 2013 Fedora Release Engineering - 0.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon May 13 2013 Hans de Goede - 0.6-3 +- Fix usbredirserver not listening for ipv6 connections (rhbz#957470) +- Fix a few (harmless) coverity warnings + +* Fri Feb 15 2013 Fedora Release Engineering - 0.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Dec 13 2012 Hans de Goede - 0.6-1 +- Update to upstream 0.6 release + +* Tue Sep 25 2012 Hans de Goede - 0.5.2-1 +- Update to upstream 0.5.2 release + +* Wed Sep 19 2012 Hans de Goede - 0.5.1-1 +- Update to upstream 0.5.1 release + +* Fri Sep 7 2012 Hans de Goede - 0.5-1 +- Update to upstream 0.5 release + +* 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 + +* Mon Apr 2 2012 Hans de Goede - 0.4.3-1 +- Update to upstream 0.4.3 release + +* Tue Mar 6 2012 Hans de Goede - 0.4.2-1 +- Update to upstream 0.4.2 release + +* Sat Feb 25 2012 Hans de Goede - 0.4.1-1 +- Update to upstream 0.4.1 release + +* Thu Feb 23 2012 Hans de Goede - 0.4-1 +- Update to upstream 0.4 release + +* Thu Jan 12 2012 Hans de Goede - 0.3.3-1 +- Update to upstream 0.3.3 release + +* Tue Jan 3 2012 Hans de Goede 0.3.2-1 +- Update to upstream 0.3.2 release + +* Wed Aug 24 2011 Hans de Goede 0.3.1-1 +- Update to upstream 0.3.1 release + +* Thu Jul 14 2011 Hans de Goede 0.3-1 +- Initial Fedora package