Hi

This is an update for comms/libhidapi to version 0.11.0.

The repository on github was moved from signal11/hidapi to libusb/hidapi.

Notable changes are listed here:
https://github.com/libusb/hidapi/releases

The attached port of hidapitester (https://github.com/todbot/hidapitester)
can be used for testing the functionality. Note that the HID devices need to
attach as ugen, not uhid/uhidev. (The hidapitester port is not meant to be
imported for now, but I found it useful for testing.)

I have compile-tested comms/sigrok devel/openocd and emulators/dolphin.



Index: Makefile
===================================================================
RCS file: /cvs/ports/comms/libhidapi/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile    12 Apr 2021 10:53:55 -0000      1.6
+++ Makefile    30 Dec 2021 19:31:34 -0000
@@ -5,17 +5,16 @@ COMMENT =     library for communicating with
 # XXX Any consumer should be patched to use hidapi_hid_init() instead of
 # hid_init(3) to avoid conflict with base usbhid(3).
 
-V =            0.8.0pre20160128
-DISTNAME =     libhidapi-${V}
-REVISION =     0
+V =            0.11.0
+DISTNAME =     libhidapi-${V}
 
-GH_ACCOUNT =   signal11
+GH_ACCOUNT =   libusb
 GH_PROJECT =   hidapi
-GH_COMMIT =    a6a622ffb680c55da0de787ff93b80280498330f
+GH_TAGNAME =   hidapi-${V}
 
 #libhidapi is symlink to hidapi-libusb. Same version numbers should be kept.
-SHARED_LIBS +=  hidapi-libusb          0.0 # 0.0
-SHARED_LIBS +=  hidapi                 0.0 # 0.0
+SHARED_LIBS +=  hidapi-libusb          0.1 # 0.0
+SHARED_LIBS +=  hidapi                 0.1 # 0.0
 
 CATEGORIES =   comms
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/comms/libhidapi/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 distinfo
--- distinfo    18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ distinfo    30 Dec 2021 19:31:34 -0000
@@ -1,2 +1,2 @@
-SHA256 (libhidapi-0.8.0pre20160128-a6a622ff.tar.gz) = 
ZvagI/auGUBb5QEGFmRuEiRsA7IAqucuLAU6IkUD5IE=
-SIZE (libhidapi-0.8.0pre20160128-a6a622ff.tar.gz) = 103980
+SHA256 (libhidapi-0.11.0.tar.gz) = OR2OUvLWpc924rDAec/v4lSXuh1GWRMSlwgfwM10RjI=
+SIZE (libhidapi-0.11.0.tar.gz) = 232631
Index: patches/patch-README_md
===================================================================
RCS file: patches/patch-README_md
diff -N patches/patch-README_md
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-README_md     30 Dec 2021 19:31:34 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
+
+Index: README.md
+--- README.md.orig
++++ README.md
+@@ -102,7 +102,7 @@ int main(int argc, char* argv[])
+       int i;
+ 
+       // Initialize the hidapi library
+-      res = hid_init();
++      res = hidapi_hid_init();
+ 
+       // Open the device using the VID, PID,
+       // and optionally the Serial number.
Index: patches/patch-README_txt
===================================================================
RCS file: patches/patch-README_txt
diff -N patches/patch-README_txt
--- patches/patch-README_txt    18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-README_txt,v 1.1.1.1 2018/06/18 23:37:01 thfr Exp $
-
-rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
-
-Index: README.txt
---- README.txt.orig
-+++ README.txt
-@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
-       int i;
- 
-       // Initialize the hidapi library
--      res = hid_init();
-+      res = hidapi_hid_init();
- 
-       // Open the device using the VID, PID,
-       // and optionally the Serial number.
Index: patches/patch-configure_ac
===================================================================
RCS file: /cvs/ports/comms/libhidapi/patches/patch-configure_ac,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-configure_ac
--- patches/patch-configure_ac  18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ patches/patch-configure_ac  30 Dec 2021 19:31:34 -0000
@@ -8,7 +8,7 @@ remove librt check
 Index: configure.ac
 --- configure.ac.orig
 +++ configure.ac
-@@ -53,7 +53,7 @@ hidapi_prog_error() {
+@@ -48,7 +48,7 @@ hidapi_prog_error() {
  AC_MSG_CHECKING([operating system])
  AC_MSG_RESULT($host)
  case $host in
@@ -17,17 +17,17 @@ Index: configure.ac
        AC_MSG_RESULT([ (Linux back-end)])
        AC_DEFINE(OS_LINUX, 1, [Linux implementations])
        AC_SUBST(OS_LINUX)
-@@ -61,13 +61,7 @@ case $host in
+@@ -56,13 +56,7 @@ case $host in
        os="linux"
        threads="pthreads"
  
 -      # HIDAPI/hidraw libs
 -      PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error 
libudev])
--      LIBS_HIDRAW_PR+=" $libudev_LIBS"
--      CFLAGS_HIDRAW+=" $libudev_CFLAGS"
+-      LIBS_HIDRAW_PR="${LIBS_HIDRAW_PR} $libudev_LIBS"
+-      CFLAGS_HIDRAW="${CFLAGS_HIDRAW} $libudev_CFLAGS"
 -
        # HIDAPI/libusb libs
--      AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], 
[hidapi_lib_error librt])
+-      AC_CHECK_LIB([rt], [clock_gettime], 
[LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lrt"], [hidapi_lib_error librt])
        PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, 
[hidapi_lib_error libusb-1.0])
-       LIBS_LIBUSB_PRIVATE+=" $libusb_LIBS"
-       CFLAGS_LIBUSB+=" $libusb_CFLAGS"
+       LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} $libusb_LIBS"
+       CFLAGS_LIBUSB="${CFLAGS_LIBUSB} $libusb_CFLAGS"
Index: patches/patch-hidapi_hidapi_h
===================================================================
RCS file: /cvs/ports/comms/libhidapi/patches/patch-hidapi_hidapi_h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-hidapi_hidapi_h
--- patches/patch-hidapi_hidapi_h       18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ patches/patch-hidapi_hidapi_h       30 Dec 2021 19:31:34 -0000
@@ -5,7 +5,7 @@ rename hid_init() to hidapi_hid_init() t
 Index: hidapi/hidapi.h
 --- hidapi/hidapi.h.orig
 +++ hidapi/hidapi.h
-@@ -93,7 +93,7 @@ extern "C" {
+@@ -130,7 +130,7 @@ extern "C" {
                        @returns
                                This function returns 0 on success and -1 on 
error.
                */
Index: patches/patch-hidtest_Makefile_am
===================================================================
RCS file: /cvs/ports/comms/libhidapi/patches/patch-hidtest_Makefile_am,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-hidtest_Makefile_am
--- patches/patch-hidtest_Makefile_am   18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ patches/patch-hidtest_Makefile_am   30 Dec 2021 19:31:34 -0000
@@ -11,9 +11,9 @@ Index: hidtest/Makefile.am
  if OS_LINUX
 -noinst_PROGRAMS = hidtest-libusb hidtest-hidraw
 -
--hidtest_hidraw_SOURCES = hidtest.cpp
+-hidtest_hidraw_SOURCES = test.c
 -hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la
 +noinst_PROGRAMS = hidtest-libusb
  
- hidtest_libusb_SOURCES = hidtest.cpp
+ hidtest_libusb_SOURCES = test.c
  hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la
Index: patches/patch-hidtest_hidtest_cpp
===================================================================
RCS file: patches/patch-hidtest_hidtest_cpp
diff -N patches/patch-hidtest_hidtest_cpp
--- patches/patch-hidtest_hidtest_cpp   18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-hidtest_hidtest_cpp,v 1.1.1.1 2018/06/18 23:37:01 thfr Exp $
-
-rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
-
-Index: hidtest/hidtest.cpp
---- hidtest/hidtest.cpp.orig
-+++ hidtest/hidtest.cpp
-@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
- 
-       struct hid_device_info *devs, *cur_dev;
-       
--      if (hid_init())
-+      if (hidapi_hid_init())
-               return -1;
- 
-       devs = hid_enumerate(0x0, 0x0);
Index: patches/patch-hidtest_test_c
===================================================================
RCS file: patches/patch-hidtest_test_c
diff -N patches/patch-hidtest_test_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-hidtest_test_c        30 Dec 2021 19:31:34 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+rename hid_init() to hidapi_hid_init() to avoid collision with usbhid
+
+Index: hidtest/test.c
+--- hidtest/test.c.orig
++++ hidtest/test.c
+@@ -50,7 +50,7 @@ int main(int argc, char* argv[])
+               printf("Compile-time version is different than runtime version 
of hidapi.\n]n");
+       }
+ 
+-      if (hid_init())
++      if (hidapi_hid_init())
+               return -1;
+ 
+       devs = hid_enumerate(0x0, 0x0);
Index: patches/patch-libusb_hid_c
===================================================================
RCS file: /cvs/ports/comms/libhidapi/patches/patch-libusb_hid_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-libusb_hid_c
--- patches/patch-libusb_hid_c  18 Jun 2018 23:37:01 -0000      1.1.1.1
+++ patches/patch-libusb_hid_c  30 Dec 2021 19:31:34 -0000
@@ -5,16 +5,16 @@ rename hid_init() to hidapi_hid_init() t
 Index: libusb/hid.c
 --- libusb/hid.c.orig
 +++ libusb/hid.c
-@@ -490,7 +490,7 @@ static char *make_path(libusb_device *dev, int interfa
+@@ -520,7 +520,7 @@ HID_API_EXPORT const char* HID_API_CALL hid_version_st
+       return HID_API_VERSION_STR;
  }
  
- 
 -int HID_API_EXPORT hid_init(void)
 +int HID_API_EXPORT hidapi_hid_init(void)
  {
        if (!usb_context) {
                const char *locale;
-@@ -529,7 +529,7 @@ struct hid_device_info  HID_API_EXPORT *hid_enumerate(
+@@ -559,7 +559,7 @@ struct hid_device_info  HID_API_EXPORT *hid_enumerate(
        struct hid_device_info *root = NULL; /* return object */
        struct hid_device_info *cur_dev = NULL;
  
@@ -23,9 +23,18 @@ Index: libusb/hid.c
                return NULL;
  
        num_devs = libusb_get_device_list(usb_context, &devs);
-@@ -877,7 +877,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *
+@@ -1001,7 +1001,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *
        int d = 0;
        int good_open = 0;
+ 
+-      if(hid_init() < 0)
++      if(hidapi_hid_init() < 0)
+               return NULL;
+ 
+       dev = new_hid_device();
+@@ -1064,7 +1064,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_libusb_wr
+       int res = 0;
+       int j = 0, k = 0;
  
 -      if(hid_init() < 0)
 +      if(hidapi_hid_init() < 0)
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/comms/libhidapi/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 PLIST
--- pkg/PLIST   4 Sep 2018 12:46:09 -0000       1.2
+++ pkg/PLIST   30 Dec 2021 19:31:34 -0000
@@ -1,7 +1,8 @@
 @comment $OpenBSD: PLIST,v 1.2 2018/09/04 12:46:09 espie Exp $
 include/hidapi/
 include/hidapi/hidapi.h
-lib/libhidapi-libusb.a
+include/hidapi/hidapi_libusb.h
+@static-lib lib/libhidapi-libusb.a
 lib/libhidapi-libusb.la
 @lib lib/libhidapi-libusb.so.${LIBhidapi-libusb_VERSION}
 @lib lib/libhidapi.so.${LIBhidapi_VERSION}
@@ -12,5 +13,5 @@ share/doc/hidapi/LICENSE-bsd.txt
 share/doc/hidapi/LICENSE-gpl3.txt
 share/doc/hidapi/LICENSE-orig.txt
 share/doc/hidapi/LICENSE.txt
-share/doc/hidapi/README.txt
+share/doc/hidapi/README.md
 share/doc/pkg-readmes/${PKGSTEM}

Attachment: hidapitester.tar.gz
Description: application/tar-gz

Reply via email to