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.
This commit is contained in:
rodent 2015-04-03 22:29:12 +00:00
parent 98224b658d
commit b55d91cf95
7 changed files with 122 additions and 0 deletions

12
comms/libhidapi/DESCR Normal file
View file

@ -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.

27
comms/libhidapi/Makefile Normal file
View file

@ -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"

5
comms/libhidapi/PLIST Normal file
View file

@ -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}

View file

@ -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

7
comms/libhidapi/distinfo Normal file
View file

@ -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

View file

@ -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

View file

@ -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;