diff options
author | tijl <tijl@FreeBSD.org> | 2014-01-04 04:42:35 +0800 |
---|---|---|
committer | tijl <tijl@FreeBSD.org> | 2014-01-04 04:42:35 +0800 |
commit | 78ebf8bcbd86984978d8b0e8db63c70ce3184287 (patch) | |
tree | 4099a3dcda435a57d07e8bd3b7b787d16e921af2 /comms | |
parent | 416ae895c880565c0a8434bca9c5873217350316 (diff) | |
download | freebsd-ports-gnome-78ebf8bcbd86984978d8b0e8db63c70ce3184287.tar.gz freebsd-ports-gnome-78ebf8bcbd86984978d8b0e8db63c70ce3184287.tar.zst freebsd-ports-gnome-78ebf8bcbd86984978d8b0e8db63c70ce3184287.zip |
New port comms/hidapi.
HIDAPI is a platform independent library that allows applications to
work with USB HID-Class devices. While it can be used to communicate
with standard HID devices like keyboards, mice, and joysticks, it is
most useful when used with custom (Vendor-Defined) HID devices.
Diffstat (limited to 'comms')
-rw-r--r-- | comms/Makefile | 1 | ||||
-rw-r--r-- | comms/hidapi/Makefile | 24 | ||||
-rw-r--r-- | comms/hidapi/distinfo | 2 | ||||
-rw-r--r-- | comms/hidapi/files/patch-configure.ac | 12 | ||||
-rw-r--r-- | comms/hidapi/files/patch-libusb-hid.c | 72 | ||||
-rw-r--r-- | comms/hidapi/pkg-descr | 6 | ||||
-rw-r--r-- | comms/hidapi/pkg-plist | 7 |
7 files changed, 124 insertions, 0 deletions
diff --git a/comms/Makefile b/comms/Makefile index 7af3d4eb0779..44528692656b 100644 --- a/comms/Makefile +++ b/comms/Makefile @@ -62,6 +62,7 @@ SUBDIR += hamlib SUBDIR += hcidump SUBDIR += hf + SUBDIR += hidapi SUBDIR += hylafax SUBDIR += ibp SUBDIR += java-commapi diff --git a/comms/hidapi/Makefile b/comms/hidapi/Makefile new file mode 100644 index 000000000000..ef644514e36f --- /dev/null +++ b/comms/hidapi/Makefile @@ -0,0 +1,24 @@ +# $FreeBSD$ + +PORTNAME= hidapi +DISTVERSION= 0.8.0-rc1 +CATEGORIES= comms + +MAINTAINER= tijl@FreeBSD.org +COMMENT= Library to access USB HID-class devices + +LICENSE= BSD3CLAUSE GPLv3 +LICENSE_COMB= dual + +USE_GITHUB= yes +GH_ACCOUNT= signal11 +GH_TAGNAME= ${PORTNAME}-${DISTVERSION} +GH_COMMIT= 40cf516 + +USE_AUTOTOOLS= aclocal autoconf autoheader automake libtoolize +AUTOMAKE_ARGS= --add-missing + +USES= iconv +USE_LDCONFIG= yes + +.include <bsd.port.mk> diff --git a/comms/hidapi/distinfo b/comms/hidapi/distinfo new file mode 100644 index 000000000000..d4478af19049 --- /dev/null +++ b/comms/hidapi/distinfo @@ -0,0 +1,2 @@ +SHA256 (hidapi-0.8.0-rc1.tar.gz) = 8cfea344b17d1dbd4d22fab70169307f5f0fbcf5f11f472322685d8d9f38d7ae +SIZE (hidapi-0.8.0-rc1.tar.gz) = 101821 diff --git a/comms/hidapi/files/patch-configure.ac b/comms/hidapi/files/patch-configure.ac new file mode 100644 index 000000000000..c443da8ec654 --- /dev/null +++ b/comms/hidapi/files/patch-configure.ac @@ -0,0 +1,12 @@ +--- configure.ac.orig ++++ configure.ac +@@ -93,7 +93,8 @@ + LDFLAGS="$LDFLAGS -L/usr/local/lib" + LIBS="${LIBS}" + AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb]) +- AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) ++ AC_CHECK_DECLS([libusb_get_string_descriptor], [], [], [[#include <libusb.h>]]) ++ AC_SEARCH_LIBS([iconv_open], [iconv], [], [hidapi_lib_error libiconv]) + echo libs_priv: $LIBS_LIBUSB_PRIVATE + ;; + *-mingw*) diff --git a/comms/hidapi/files/patch-libusb-hid.c b/comms/hidapi/files/patch-libusb-hid.c new file mode 100644 index 000000000000..5a8968eab24e --- /dev/null +++ b/comms/hidapi/files/patch-libusb-hid.c @@ -0,0 +1,72 @@ +--- libusb/hid.c.orig ++++ libusb/hid.c +@@ -25,6 +25,8 @@ + + #define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */ + ++#include <config.h> ++ + /* C */ + #include <stdio.h> + #include <string.h> +@@ -250,7 +252,7 @@ + } + #endif /* INVASIVE_GET_USAGE */ + +-#ifdef __FreeBSD__ ++#if ! HAVE_DECL_LIBUSB_GET_STRING_DESCRIPTOR + /* The FreeBSD version of libusb doesn't have this funciton. In mainline + libusb, it's inlined in libusb.h. This function will bear a striking + resemblence to that one, because there's about one way to code it. +@@ -324,6 +326,7 @@ + static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) + { + char buf[512]; ++ char buf2[512]; + int len; + wchar_t *str = NULL; + wchar_t wbuf[256]; +@@ -359,7 +362,7 @@ + it is only passed into iconv() which does not need it. */ + + /* Initialize iconv. */ +- ic = iconv_open("WCHAR_T", "UTF-16LE"); ++ ic = iconv_open("char", "UTF-16LE"); + if (ic == (iconv_t)-1) { + LOG("iconv_open() failed\n"); + return NULL; +@@ -369,18 +372,21 @@ + Skip the first character (2-bytes). */ + inptr = buf+2; + inbytes = len-2; +- outptr = (char*) wbuf; +- outbytes = sizeof(wbuf); ++ outptr = buf2; ++ outbytes = sizeof(buf2); + res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes); + if (res == (size_t)-1) { + LOG("iconv() failed\n"); + goto err; + } ++ res = mbstowcs(wbuf, buf2, sizeof(wbuf)/sizeof(wbuf[0])); ++ if (res == (size_t)-1) { ++ LOG("mbstowcs() failed\n"); ++ goto err; ++ } + + /* Write the terminating NULL. */ + wbuf[sizeof(wbuf)/sizeof(wbuf[0])-1] = 0x00000000; +- if (outbytes >= sizeof(wbuf[0])) +- *((wchar_t*)outptr) = 0x00000000; + + /* Allocate and copy the string. */ + str = wcsdup(wbuf); +@@ -757,7 +763,7 @@ + libusb_cancel_transfer(dev->transfer); + + while (!dev->cancelled) +- libusb_handle_events_completed(usb_context, &dev->cancelled); ++ libusb_handle_events(usb_context); + + /* Now that the read thread is stopping, Wake any threads which are + waiting on data (in hid_read_timeout()). Do this under a mutex to diff --git a/comms/hidapi/pkg-descr b/comms/hidapi/pkg-descr new file mode 100644 index 000000000000..7b67c9fb323e --- /dev/null +++ b/comms/hidapi/pkg-descr @@ -0,0 +1,6 @@ +HIDAPI is a platform independent library that allows applications to +work with USB HID-Class devices. While it can be used to communicate +with standard HID devices like keyboards, mice, and joysticks, it is +most useful when used with custom (Vendor-Defined) HID devices. + +WWW: http://www.signal11.us/oss/hidapi/ diff --git a/comms/hidapi/pkg-plist b/comms/hidapi/pkg-plist new file mode 100644 index 000000000000..21941c92edc6 --- /dev/null +++ b/comms/hidapi/pkg-plist @@ -0,0 +1,7 @@ +include/hidapi/hidapi.h +lib/libhidapi.a +lib/libhidapi.la +lib/libhidapi.so +lib/libhidapi.so.0 +libdata/pkgconfig/hidapi.pc +@dirrm include/hidapi |