@@ -1,10 +1,8 @@
config BR2_PACKAGE_HIDAPI
bool "hidapi"
- depends on BR2_PACKAGE_HAS_UDEV
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libusb
select BR2_PACKAGE_LIBUSB
- select BR2_PACKAGE_LIBGUDEV
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
# runtime UTF conversion support
select BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY if BR2_TOOLCHAIN_USES_GLIBC
@@ -13,9 +11,31 @@ config BR2_PACKAGE_HIDAPI
to interface with USB and Bluetooth HID-Class devices on
Windows, Linux, and Mac OS X.
+ On Linux you can disable the hidraw backend (see below) to
+ build only libhidapi-libusb, which does not require udev.
+
http://github.com/libusb/hidapi/
-comment "hidapi needs udev /dev management and a toolchain w/ NPTL, gcc >= 4.9"
+if BR2_PACKAGE_HIDAPI
+
+comment "hidapi hidraw backend unavailable (no udev - enable eudev or systemd)"
+ depends on !BR2_PACKAGE_HAS_UDEV
+
+config BR2_PACKAGE_HIDAPI_HIDRAW
+ bool "hidraw backend"
+ default y if BR2_PACKAGE_HAS_UDEV
+ depends on BR2_PACKAGE_HAS_UDEV
+ help
+ Build the Linux hidraw implementation (libhidapi-hidraw). This
+ requires libudev from a udev provider (eudev or systemd).
+
+ Say 'n' here to build only the libusb backend
+ (libhidapi-libusb), which is enough for applications that
+ link against hidapi-libusb and allows using HIDAPI on systems
+ without udev.
+
+endif
+
+comment "hidapi needs a toolchain w/ NPTL and gcc >= 4.9"
depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
- !BR2_PACKAGE_HAS_UDEV || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
@@ -7,16 +7,26 @@
HIDAPI_VERSION = 0.15.0
HIDAPI_SITE = $(call github,libusb,hidapi,hidapi-$(HIDAPI_VERSION))
HIDAPI_INSTALL_STAGING = YES
-# No configure provided, so we need to autoreconf.
-HIDAPI_AUTORECONF = YES
+HIDAPI_SUPPORTS_IN_SOURCE_BUILD = NO
HIDAPI_LICENSE = GPL-3.0 or BSD-3-Clause or HIDAPI license
HIDAPI_LICENSE_FILES = LICENSE.txt LICENSE-gpl3.txt LICENSE-bsd.txt LICENSE-orig.txt
-HIDAPI_DEPENDENCIES = libusb libgudev
+HIDAPI_DEPENDENCIES = libusb
+
+HIDAPI_CONF_OPTS = \
+ -DHIDAPI_WITH_LIBUSB=ON \
+ -DHIDAPI_WITH_TESTS=OFF \
+ -DHIDAPI_BUILD_HIDTEST=OFF
+
+ifeq ($(BR2_PACKAGE_HIDAPI_HIDRAW),y)
+HIDAPI_CONF_OPTS += -DHIDAPI_WITH_HIDRAW=ON
+HIDAPI_DEPENDENCIES += udev
+else
+HIDAPI_CONF_OPTS += -DHIDAPI_WITH_HIDRAW=OFF
+endif
ifeq ($(BR2_PACKAGE_LIBICONV),y)
HIDAPI_DEPENDENCIES += libiconv
-HIDAPI_CONF_ENV += LIBS="-liconv"
endif
-$(eval $(autotools-package))
+$(eval $(cmake-package))
This allows use of libhidapi on tiny systems without udev Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com> --- package/hidapi/Config.in | 28 ++++++++++++++++++++++++---- package/hidapi/hidapi.mk | 20 +++++++++++++++----- 2 files changed, 39 insertions(+), 9 deletions(-)