From 8e7d7a47a17a778e2d324f7633760067d643b5bb Mon Sep 17 00:00:00 2001 From: rodent Date: Fri, 3 Apr 2015 22:29:12 +0000 Subject: Import libhidapi-0.7.0 as comms/libhidapi. HIDAPI is a multi-platform library which allows an application to interface with USB and Bluetooth HID-Class devices on Windows, Linux, and Mac OS X. On Windows, a DLL is built. On other platforms (and optionally on Windows), the single source file can simply be dropped into a target application. HIDAPI has four back-ends: * Windows (using hid.dll) * Linux/hidraw (using the Kernel's hidraw driver) * Linux/libusb (using libusb-1.0) * Mac (using IOHidManager) This package includes only the libusb backend. --- comms/libhidapi/DESCR | 12 +++++++ comms/libhidapi/Makefile | 27 +++++++++++++++ comms/libhidapi/PLIST | 5 +++ comms/libhidapi/buildlink3.mk | 12 +++++++ comms/libhidapi/distinfo | 7 ++++ comms/libhidapi/patches/patch-Makefile | 44 ++++++++++++++++++++++++ comms/libhidapi/patches/patch-linux_hid-libusb.c | 15 ++++++++ 7 files changed, 122 insertions(+) create mode 100644 comms/libhidapi/DESCR create mode 100644 comms/libhidapi/Makefile create mode 100644 comms/libhidapi/PLIST create mode 100644 comms/libhidapi/buildlink3.mk create mode 100644 comms/libhidapi/distinfo create mode 100644 comms/libhidapi/patches/patch-Makefile create mode 100644 comms/libhidapi/patches/patch-linux_hid-libusb.c (limited to 'comms') diff --git a/comms/libhidapi/DESCR b/comms/libhidapi/DESCR new file mode 100644 index 00000000000..fe10341f100 --- /dev/null +++ b/comms/libhidapi/DESCR @@ -0,0 +1,12 @@ +HIDAPI is a multi-platform library which allows an application to interface +with USB and Bluetooth HID-Class devices on Windows, Linux, and Mac OS X. +On Windows, a DLL is built. On other platforms (and optionally on Windows), +the single source file can simply be dropped into a target application. + +HIDAPI has four back-ends: + * Windows (using hid.dll) + * Linux/hidraw (using the Kernel's hidraw driver) + * Linux/libusb (using libusb-1.0) + * Mac (using IOHidManager) + +This package includes only the libusb backend. diff --git a/comms/libhidapi/Makefile b/comms/libhidapi/Makefile new file mode 100644 index 00000000000..4b010256316 --- /dev/null +++ b/comms/libhidapi/Makefile @@ -0,0 +1,27 @@ +# $NetBSD: Makefile,v 1.1 2015/04/03 22:29:12 rodent Exp $ + +GITHUB_PROJECT= hidapi +GITHUB_TAG= ${GITHUB_PROJECT}-0.7.0 +DISTNAME= ${GITHUB_TAG} +PKGNAME= lib${DISTNAME} +CATEGORIES= comms devel +MASTER_SITES= ${MASTER_SITE_GITHUB:=signal11/} + +MAINTAINER= nathanialsloss@yahoo.com.au +HOMEPAGE= http://www.signal11.us/oss/hidapi/ +COMMENT= Library for comunicating with bluetooth and usb hid devices +LICENSE= gnu-gpl-v3 OR modified-bsd + +USE_LANGUAGES= c c++ +USE_TOOLS+= gmake pkg-config + +NO_CONFIGURE= yes +WRKSRC= ${WRKDIR}/hidapi-${DISTNAME} +INSTALLATION_DIRS+= include/hidapi lib + +.include "../../mk/bsd.fast.prefs.mk" + +CFLAGS+= -fPIC + +.include "../../devel/libusb1/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/comms/libhidapi/PLIST b/comms/libhidapi/PLIST new file mode 100644 index 00000000000..f42240f5437 --- /dev/null +++ b/comms/libhidapi/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1 2015/04/03 22:29:12 rodent Exp $ +include/hidapi/hidapi.h +lib/libhidapi.so +lib/libhidapi.so.0 +lib/libhidapi.so.${PKGVERSION} diff --git a/comms/libhidapi/buildlink3.mk b/comms/libhidapi/buildlink3.mk new file mode 100644 index 00000000000..3059acf0650 --- /dev/null +++ b/comms/libhidapi/buildlink3.mk @@ -0,0 +1,12 @@ +# $NetBSD: buildlink3.mk,v 1.1 2015/04/03 22:29:12 rodent Exp $ + +BUILDLINK_TREE+= libhidapi + +.if !defined(LIBHIDAPI_BUILDLINK3_MK) +LIBHIDAPI_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.libhidapi+= libhidapi>=0.7.0 +BUILDLINK_PKGSRCDIR.libhidapi?= ../../comms/libhidapi +.endif + +BUILDLINK_TREE+= -libhidapi diff --git a/comms/libhidapi/distinfo b/comms/libhidapi/distinfo new file mode 100644 index 00000000000..5fba997aa40 --- /dev/null +++ b/comms/libhidapi/distinfo @@ -0,0 +1,7 @@ +$NetBSD: distinfo,v 1.1 2015/04/03 22:29:12 rodent Exp $ + +SHA1 (hidapi-0.7.0.tar.gz) = caed4fd63098293fec487e8673ea992d35db04ba +RMD160 (hidapi-0.7.0.tar.gz) = 02ccd173c547cda5e65144eea331d608a5aff414 +Size (hidapi-0.7.0.tar.gz) = 1618395 bytes +SHA1 (patch-Makefile) = 9cc8e81d22a05a1132cf35c3d62656202e0788b9 +SHA1 (patch-linux_hid-libusb.c) = 908032c29cbdb0e4aef0eaa370d840a8a8696eea diff --git a/comms/libhidapi/patches/patch-Makefile b/comms/libhidapi/patches/patch-Makefile new file mode 100644 index 00000000000..32e683b7c5b --- /dev/null +++ b/comms/libhidapi/patches/patch-Makefile @@ -0,0 +1,44 @@ +$NetBSD: patch-Makefile,v 1.1 2015/04/03 22:29:12 rodent Exp $ + +Makefile for libhidapi.so + +--- Makefile.orig 2014-01-08 11:11:31.000000000 +0000 ++++ Makefile +@@ -0,0 +1,37 @@ ++########################################### ++# Simple Makefile for HIDAPI test program ++# ++# Alan Ott ++# Signal 11 Software ++# 2010-06-01 ++########################################### ++ ++all: libhidapi.so.0.7.0 ++ ++CC ?= gcc ++CFLAGS ?= -Wall -g ++ ++CXX ?= g++ ++CXXFLAGS ?= -Wall -g ++ ++COBJS = linux/hid-libusb.o ++OBJS = $(COBJS) ++LIBS = `pkg-config libusb-1.0 --libs` ++INCLUDES ?= -Ihidapi `pkg-config libusb-1.0 --cflags` ++ ++ ++libhidapi.so.0.7.0: $(OBJS) ++ $(CC) $(CFLAGS) -shared $(LDFLAGS) $^ $(LIBS) -o libhidapi.so.0.7.0 ++ ++$(COBJS): %.o: %.c ++ $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ ++ ++install: ++ ${BSD_INSTALL_DATA} hidapi/* $(DESTDIR)$(PREFIX)/include/hidapi ++ ${BSD_INSTALL_LIB} libhidapi.so.0.7.0 $(DESTDIR)$(PREFIX)/lib ++ ln -s libhidapi.so.0.7.0 $(DESTDIR)$(PREFIX)/lib/libhidapi.so.0 ++ ln -s libhidapi.so.0.7.0 $(DESTDIR)$(PREFIX)/lib/libhidapi.so ++clean: ++ rm -f $(OBJS) libhidapi.so.0.7.0 ++ ++.PHONY: clean diff --git a/comms/libhidapi/patches/patch-linux_hid-libusb.c b/comms/libhidapi/patches/patch-linux_hid-libusb.c new file mode 100644 index 00000000000..ceaf2cfaa67 --- /dev/null +++ b/comms/libhidapi/patches/patch-linux_hid-libusb.c @@ -0,0 +1,15 @@ +$NetBSD: patch-linux_hid-libusb.c,v 1.1 2015/04/03 22:29:12 rodent Exp $ + +inptr has to be type casted for iconv on NetBSD. + +--- linux/hid-libusb.c.orig 2011-10-26 00:58:17.000000000 +0000 ++++ linux/hid-libusb.c +@@ -351,7 +351,7 @@ static wchar_t *get_usb_string(libusb_de + inbytes = len-2; + outptr = (char*) wbuf; + outbytes = sizeof(wbuf); +- res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes); ++ res = iconv(ic, (const char **) &inptr, &inbytes, &outptr, &outbytes); + if (res == (size_t)-1) + goto err; + -- cgit v1.2.3