aboutsummaryrefslogtreecommitdiffstats
path: root/net/usbredir
diff options
context:
space:
mode:
authornox <nox@FreeBSD.org>2011-08-21 23:43:02 +0800
committernox <nox@FreeBSD.org>2011-08-21 23:43:02 +0800
commit1b8b318dcb972fbcd2387170f2dd116f1e30ac1a (patch)
tree92d3b91dea661de9a09416d5811896efcf8ec0c2 /net/usbredir
parent0c69aea14ec15c406b45168c16e7e1bab94908e6 (diff)
downloadfreebsd-ports-gnome-1b8b318dcb972fbcd2387170f2dd116f1e30ac1a.tar.gz
freebsd-ports-gnome-1b8b318dcb972fbcd2387170f2dd116f1e30ac1a.tar.zst
freebsd-ports-gnome-1b8b318dcb972fbcd2387170f2dd116f1e30ac1a.zip
usbredir is a protocol for redirection USB traffic from a single USB device,
to a different (virtual) machine then the one to which the USB device is attached. See usb-redirection-protocol.txt for the description / definition of this protocol. With the official 0.3 release the protocol is now frozen (only extensions advertised through capabilities can be added from now on). WWW: http://cgit.freedesktop.org/~jwrdegoede/usbredir/
Diffstat (limited to 'net/usbredir')
-rw-r--r--net/usbredir/Makefile34
-rw-r--r--net/usbredir/distinfo2
-rw-r--r--net/usbredir/files/libusb-1.0.pc10
-rw-r--r--net/usbredir/files/patch-usbredirhost-usbredirhost.c92
-rw-r--r--net/usbredir/files/patch-usbredirserver-usbredirserver.c12
-rw-r--r--net/usbredir/files/patch-usbredirtestclient-usbredirtestclient.c12
-rw-r--r--net/usbredir/pkg-descr9
-rw-r--r--net/usbredir/pkg-plist10
8 files changed, 181 insertions, 0 deletions
diff --git a/net/usbredir/Makefile b/net/usbredir/Makefile
new file mode 100644
index 000000000000..a2d308a76dd2
--- /dev/null
+++ b/net/usbredir/Makefile
@@ -0,0 +1,34 @@
+# Ports collection makefile for: usbredir
+# Date created: Mon Aug 15 18:16:38 CEST 2011
+# Whom: Juergen Lock <nox@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= usbredir
+PORTVERSION= 0.3
+CATEGORIES= net devel
+MASTER_SITES= http://people.fedoraproject.org/~jwrdegoede/
+
+MAINTAINER= nox@FreeBSD.org
+COMMENT= A protocol for redirection of USB traffic
+
+USE_BZIP2= yes
+MAKE_JOBS_SAFE= yes
+USE_GMAKE= yes
+USE_GNOME= pkgconfig
+PATCH_STRIP= -p1
+MAKE_ARGS+= PREFIX=${PREFIX}
+
+.include <bsd.port.options.mk>
+
+.if ${OSVERSION} < 800069
+IGNORE= needs libusb 1.0
+.else
+MAKE_ENV+= PKG_CONFIG_PATH=${FILESDIR}
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} "s|\\\$$(LIBDIR)/pkgconfig|${PREFIX}/libdata/pkgconfig|" ${WRKSRC}/*/Makefile
+
+.include <bsd.port.mk>
diff --git a/net/usbredir/distinfo b/net/usbredir/distinfo
new file mode 100644
index 000000000000..0bc416a89c6f
--- /dev/null
+++ b/net/usbredir/distinfo
@@ -0,0 +1,2 @@
+SHA256 (usbredir-0.3.tar.bz2) = 385ae4511e2f3d39ab9f1b68d1668ca70ff4c52ddf8274c603cf5b3de7aca6a6
+SIZE (usbredir-0.3.tar.bz2) = 37295
diff --git a/net/usbredir/files/libusb-1.0.pc b/net/usbredir/files/libusb-1.0.pc
new file mode 100644
index 000000000000..52d26e32078b
--- /dev/null
+++ b/net/usbredir/files/libusb-1.0.pc
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: libusb
+Description: USB access library
+Version: 1.0.1
+Libs: -L${libdir} -lusb
+Cflags: -I${includedir}
diff --git a/net/usbredir/files/patch-usbredirhost-usbredirhost.c b/net/usbredir/files/patch-usbredirhost-usbredirhost.c
new file mode 100644
index 000000000000..cb4e328d0e7b
--- /dev/null
+++ b/net/usbredir/files/patch-usbredirhost-usbredirhost.c
@@ -0,0 +1,92 @@
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -27,6 +27,71 @@
+ #include <unistd.h>
+ #include "usbredirhost.h"
+
++/*
++ * passing actual enum libusb_speed libusb_get_device_speed() return
++ * values other than LIBUSB_SPEED_UNKNOWN causes qemu 0.15.0 to
++ * complain when redirecting usb 2.0 devices when ehci isn't enabled
++ * (-readconfig docs/ich9-ehci-uhci.cfg, which breaks at least
++ * FreeBSD 8 guests and hangs at boot in seabios(?) when redirecting
++ * an usb 2.0 flashkey) - it says:
++ *
++ * qemu: Warning: speed mismatch trying to attach usb device USB Redirection Device to bus usb.0
++ *
++ * and ignores the redirected device. Thus, for now always assume
++ * speed unknown:
++ */
++#define IGNORE_LIBUSB_GET_DEVICE_SPEED
++
++/* The following is only interesting once the above is fixed: */
++#ifndef IGNORE_LIBUSB_GET_DEVICE_SPEED
++#define HAVE_LIBUSB_GET_DEVICE_SPEED
++
++#ifdef __FreeBSD__
++/* #undef this if libusb_get_device_speed() is missing in your
++ * version of FreeBSD (not relevant if IGNORE_LIBUSB_GET_DEVICE_SPEED
++ * is defined) */
++/* #undef HAVE_LIBUSB_GET_DEVICE_SPEED */
++
++#ifndef HAVE_LIBUSB_GET_DEVICE_SPEED
++#include <libusb20.h>
++#define HAVE_SRC /* this only works if system sources are available */
++#ifdef HAVE_SRC
++#include "/usr/src/lib/libusb/libusb10.h"
++#endif
++
++enum libusb_speed {
++ LIBUSB_SPEED_UNKNOWN = 0,
++ LIBUSB_SPEED_LOW = 1,
++ LIBUSB_SPEED_FULL = 2,
++ LIBUSB_SPEED_HIGH = 3,
++ LIBUSB_SPEED_SUPER = 4,
++};
++
++enum libusb_speed libusb_get_device_speed(libusb_device *dev)
++{
++#ifdef HAVE_SRC
++ if (dev == NULL)
++ return (LIBUSB_SPEED_UNKNOWN); /* should not happen */
++
++ switch (libusb20_dev_get_speed(dev->os_priv)) {
++ case LIBUSB20_SPEED_LOW:
++ return (LIBUSB_SPEED_LOW);
++ case LIBUSB20_SPEED_FULL:
++ return (LIBUSB_SPEED_FULL);
++ case LIBUSB20_SPEED_HIGH:
++ return (LIBUSB_SPEED_HIGH);
++ case LIBUSB20_SPEED_SUPER:
++ return (LIBUSB_SPEED_SUPER);
++ default:
++ break;
++ }
++#endif
++ return (LIBUSB_SPEED_UNKNOWN);
++}
++#endif
++#endif
++#endif
++
+ #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 */
+@@ -487,6 +552,9 @@ struct usbredirhost *usbredirhost_open(
+ return NULL;
+ }
+
++#ifdef IGNORE_LIBUSB_GET_DEVICE_SPEED
++ device_connect.speed = usb_redir_speed_unknown;
++#else
+ speed = libusb_get_device_speed(host->dev);
+ switch (speed) {
+ case LIBUSB_SPEED_LOW:
+@@ -500,6 +568,7 @@ struct usbredirhost *usbredirhost_open(
+ default:
+ device_connect.speed = usb_redir_speed_unknown;
+ }
++#endif
+ device_connect.device_class = desc.bDeviceClass;
+ device_connect.device_subclass = desc.bDeviceSubClass;
+ device_connect.device_protocol = desc.bDeviceProtocol;
diff --git a/net/usbredir/files/patch-usbredirserver-usbredirserver.c b/net/usbredir/files/patch-usbredirserver-usbredirserver.c
new file mode 100644
index 000000000000..de387f8b7e93
--- /dev/null
+++ b/net/usbredir/files/patch-usbredirserver-usbredirserver.c
@@ -0,0 +1,12 @@
+--- a/usbredirserver/usbredirserver.c
++++ b/usbredirserver/usbredirserver.c
+@@ -33,6 +33,9 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <netdb.h>
++#ifdef __FreeBSD__
++#include <netinet/in.h>
++#endif
+ #include "usbredirhost.h"
+
+ #define VERSION "usbredirserver " USBREDIR_VERSION
diff --git a/net/usbredir/files/patch-usbredirtestclient-usbredirtestclient.c b/net/usbredir/files/patch-usbredirtestclient-usbredirtestclient.c
new file mode 100644
index 000000000000..5dc291c1041c
--- /dev/null
+++ b/net/usbredir/files/patch-usbredirtestclient-usbredirtestclient.c
@@ -0,0 +1,12 @@
+--- a/usbredirtestclient/usbredirtestclient.c
++++ b/usbredirtestclient/usbredirtestclient.c
+@@ -33,6 +33,9 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <netdb.h>
++#ifdef __FreeBSD__
++#include <netinet/in.h>
++#endif
+ #include "usbredirparser.h"
+
+ /* Macros to go from an endpoint address to an index for our ep array */
diff --git a/net/usbredir/pkg-descr b/net/usbredir/pkg-descr
new file mode 100644
index 000000000000..92f6ef230432
--- /dev/null
+++ b/net/usbredir/pkg-descr
@@ -0,0 +1,9 @@
+usbredir is a protocol for redirection USB traffic from a single USB device,
+to a different (virtual) machine then the one to which the USB device is
+attached. See usb-redirection-protocol.txt for the description / definition
+of this protocol.
+
+With the official 0.3 release the protocol is now frozen (only extensions
+advertised through capabilities can be added from now on).
+
+WWW: http://cgit.freedesktop.org/~jwrdegoede/usbredir/
diff --git a/net/usbredir/pkg-plist b/net/usbredir/pkg-plist
new file mode 100644
index 000000000000..8706dd8c4508
--- /dev/null
+++ b/net/usbredir/pkg-plist
@@ -0,0 +1,10 @@
+include/usbredirhost.h
+include/usbredirproto.h
+include/usbredirparser.h
+lib/libusbredirparser.so
+lib/libusbredirparser.so.0
+lib/libusbredirhost.so
+lib/libusbredirhost.so.0
+libdata/pkgconfig/libusbredirparser.pc
+libdata/pkgconfig/libusbredirhost.pc
+sbin/usbredirserver