From: Tomas Mudrunka <tomas.mudrunka@gmail.com>
To: buildroot@buildroot.org
Cc: Adrian Perez de Castro <aperez@igalia.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Tomas Mudrunka <tomas.mudrunka@gmail.com>
Subject: [Buildroot] [PATCH v2 4/5] package/hidapi: make the hidraw backend optional
Date: Fri, 13 Nov 2026 15:52:00 +0100 [thread overview]
Message-ID: <20261113145201.2357363-5-tomas.mudrunka@gmail.com> (raw)
In-Reply-To: <20261113145201.2357363-1-tomas.mudrunka@gmail.com>
The hidraw backend is the only part of hidapi that needs udev (for
libudev); the libusb backend only needs libusb. Make the hidraw backend
optional through a new BR2_PACKAGE_HIDAPI_HIDRAW option, available
when a udev provider is enabled and enabled by default, so existing
configurations are unchanged.
This allows hidapi (libhidapi-libusb) to be used on small systems
without udev. The BR2_USE_MMU dependency, which was only needed for
udev, is dropped from hidapi.
All in-tree users of hidapi, except libmanette, can use either backend
(they look up hidapi-hidraw and hidapi-libusb, or load either library
at runtime). libmanette only looks up hidapi-hidraw.pc, so make it
select BR2_PACKAGE_HIDAPI_HIDRAW.
Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
---
package/hidapi/Config.in | 23 ++++++++++++++++++-----
package/hidapi/hidapi.mk | 10 ++++++++--
package/libmanette/Config.in | 3 ++-
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/package/hidapi/Config.in b/package/hidapi/Config.in
index 72ae32a6d8..aec90e9501 100644
--- a/package/hidapi/Config.in
+++ b/package/hidapi/Config.in
@@ -1,9 +1,7 @@
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
- depends on BR2_USE_MMU # udev
depends on BR2_USE_WCHAR # wcsdup()
select BR2_PACKAGE_LIBUSB
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
@@ -14,11 +12,26 @@ config BR2_PACKAGE_HIDAPI
to interface with USB and Bluetooth HID-Class devices on
Windows, Linux, and Mac OS X.
+ The libusb backend (libhidapi-libusb) is always built.
+
http://github.com/libusb/hidapi/
-comment "hidapi needs udev /dev management and a toolchain w/ NPTL, gcc >= 4.9, wchar"
- depends on BR2_USE_MMU
+if BR2_PACKAGE_HIDAPI
+
+config BR2_PACKAGE_HIDAPI_HIDRAW
+ bool "hidraw backend"
+ default y
+ depends on BR2_PACKAGE_HAS_UDEV
+ help
+ Build the hidraw backend (libhidapi-hidraw), which uses the
+ kernel hidraw interface and needs libudev.
+
+comment "hidraw backend needs udev /dev management"
+ depends on !BR2_PACKAGE_HAS_UDEV
+
+endif
+
+comment "hidapi needs a toolchain w/ NPTL, gcc >= 4.9, wchar"
depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
- !BR2_PACKAGE_HAS_UDEV || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
!BR2_USE_WCHAR
diff --git a/package/hidapi/hidapi.mk b/package/hidapi/hidapi.mk
index 5f0c482a95..884912f175 100644
--- a/package/hidapi/hidapi.mk
+++ b/package/hidapi/hidapi.mk
@@ -10,14 +10,20 @@ HIDAPI_INSTALL_STAGING = YES
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 udev
+HIDAPI_DEPENDENCIES = libusb
HIDAPI_CONF_OPTS = \
- -DHIDAPI_WITH_HIDRAW=ON \
-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
endif
diff --git a/package/libmanette/Config.in b/package/libmanette/Config.in
index 0f3a5a7bb0..9377f35a42 100644
--- a/package/libmanette/Config.in
+++ b/package/libmanette/Config.in
@@ -2,11 +2,12 @@ config BR2_PACKAGE_LIBMANETTE
bool "libmanette"
depends on BR2_USE_MMU # libglib2, hidapi
depends on BR2_USE_WCHAR # libglib2, hidapi
- depends on BR2_PACKAGE_HAS_UDEV # hidapi
+ depends on BR2_PACKAGE_HAS_UDEV # hidapi-hidraw
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # hidapi
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_16
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # hidapi -> libusb
select BR2_PACKAGE_HIDAPI
+ select BR2_PACKAGE_HIDAPI_HIDRAW # needs hidapi-hidraw.pc
select BR2_PACKAGE_LIBEVDEV
select BR2_PACKAGE_LIBGLIB2
select BR2_PACKAGE_LIBGUDEV
--
2.56.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-11-13 14:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 13:00 [Buildroot] [PATCH 1/1] package/hidapi: add support for build without hidraw support when udev is not available Tomas Mudrunka
2026-11-13 14:51 ` [Buildroot] [PATCH v2 0/5] package/hidapi: allow building without udev Tomas Mudrunka
2026-11-13 14:51 ` [Buildroot] [PATCH v2 1/5] package/libmanette: select libgudev Tomas Mudrunka
2026-11-13 14:51 ` [Buildroot] [PATCH v2 2/5] package/hidapi: depend on udev instead of libgudev Tomas Mudrunka
2026-11-13 14:51 ` [Buildroot] [PATCH v2 3/5] package/hidapi: convert to cmake-package Tomas Mudrunka
2026-11-13 14:52 ` Tomas Mudrunka [this message]
2026-11-13 14:52 ` [Buildroot] [PATCH v2 5/5] DEVELOPERS: add Tomas Mudrunka for hidapi Tomas Mudrunka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113145201.2357363-5-tomas.mudrunka@gmail.com \
--to=tomas.mudrunka@gmail.com \
--cc=aperez@igalia.com \
--cc=buildroot@buildroot.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox