libsigrok: use libhidapi's hid_init() instead of our usbhid(3)'s one

Because our usbhid(3) defines hid_init(3), the libhidapi's one has been
renamed to hidapi_hid_init(). Sigrok expects the libhidapi one. This led
to build failures on ld.bfd arches, and probably runtime errors on other
arches.

As such, redefine the hid_init() call to hidapi_hid_init().

OK sthen@, kmos@ (who build tested on sparc64) and
"seems ok to me" bentley@ (maintainer)
This commit is contained in:
cwen 2021-04-12 11:22:33 +00:00
parent 4022502446
commit 810ffbcc70
2 changed files with 24 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.11 2021/03/06 22:42:43 bentley Exp $
# $OpenBSD: Makefile,v 1.12 2021/04/12 11:22:33 cwen Exp $
COMMENT = sigrok hardware driver library
SIGROK_PROJECT = libsigrok
SIGROK_VERSION = 0.5.2
MODPY_EGG_VERSION = ${SIGROK_VERSION}
REVISION = 0
REVISION = 1
SHARED_LIBS += sigrok 0.1 # 0.0
SHARED_LIBS += sigrokcxx 0.1 # 4.0

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_backend_c,v 1.1 2021/04/12 11:22:33 cwen Exp $
Fix for:
src/backend.c:613:6: warning: implicit declaration of function 'hid_init'
is invalid in C99
On ld.bfd arches, this led to undefined references at build time.
It appears that comms/libhidapi redefines hid_init(3) to hidapi_hid_init().
Index: src/backend.c
--- src/backend.c.orig
+++ src/backend.c
@@ -23,6 +23,9 @@
#ifdef _WIN32
#include <winsock2.h>
#endif
+#ifdef __OpenBSD__
+#define hid_init hidapi_hid_init
+#endif
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"