Skip to contentSkip to conversation

package/libudev-zero: bump version to 1.0.4

PATCH In review Bernd Kuhls 2 participants 5 messages Jun 15 – Jun 17 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/libudev-zero: bump version to 1.0.4

https://github.com/illiliti/libudev-zero/releases/tag/1.0.4

Removed patch which is included in this release.

Added buildroot-specific PREFIX to _BUILD_CMDS to override default '/usr/local' in upstream Makefile to be compatible with the install location of usb.ids provided by the hwdata package.

---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/787f089f803e70db0e0a91dd6cb4ed5f319cb280

 ...01-Avoidable-OOM-on-small-systems-62.patch | 176 ------------------
 package/libudev-zero/libudev-zero.hash        |   2 +-
 package/libudev-zero/libudev-zero.mk          |   5 +-
 3 files changed, 4 insertions(+), 179 deletions(-)
 delete mode 100644 package/libudev-zero/0001-Avoidable-OOM-on-small-systems-62.patch
package/libudev-zero/0001-Avoidable-OOM-on-small-systems-62.patch deleted +0 -176
deleted file mode 100644
index 275581becf..0000000000
@@ -1,176 +0,0 @@
-From 5eca08d71d51074bfe7b14fcf7d89318f4f6ff47 Mon Sep 17 00:00:00 2001
-From: liamHowatt <[email protected]>
-Date: Tue, 5 Dec 2023 04:15:26 -0500
-Subject: [PATCH] Avoidable OOM on small systems (#62)
-
-* bandaid fix OOM
-
-* refactor fix OOM
-
-* Makefile: remove no longer needed -pthread option
-
-* libudev.pc.in: remove threads requirement
-
----------
-
-Co-authored-by: illiliti <[email protected]>
-
-Upstream: https://github.com/illiliti/libudev-zero/commit/5eca08d71d51074bfe7b14fcf7d89318f4f6ff47
-
-Signed-off-by: Bernd Kuhls <[email protected]>
----
- Makefile         |  2 +-
- libudev.pc.in    |  1 -
- udev_enumerate.c | 65 +++++++++++-------------------------------------
- 3 files changed, 15 insertions(+), 53 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 4e970b8..1fc5a1f 100644
---- a/Makefile
-+++ b/Makefile
-@@ -5,7 +5,7 @@ PREFIX = /usr/local
- LIBDIR = ${PREFIX}/lib
- INCLUDEDIR = ${PREFIX}/include
- PKGCONFIGDIR = ${LIBDIR}/pkgconfig
--XCFLAGS = ${CPPFLAGS} ${CFLAGS} -std=c99 -fPIC -pthread -D_XOPEN_SOURCE=700 \
-+XCFLAGS = ${CPPFLAGS} ${CFLAGS} -std=c99 -fPIC -D_XOPEN_SOURCE=700 \
- 		  -Wall -Wextra -Wpedantic -Wmissing-prototypes -Wstrict-prototypes \
- 		  -Wno-unused-parameter
- XLDFLAGS = ${LDFLAGS} -shared -Wl,-soname,libudev.so.1
-diff --git a/libudev.pc.in b/libudev.pc.in
-index 7e29d8c..2d3f0b0 100644
---- a/libudev.pc.in
-+++ b/libudev.pc.in
-@@ -9,5 +9,4 @@ Description: Daemonless replacement for libudev
- Version: @VERSION@
- URL: https://github.com/illiliti/libudev-zero
- Libs: -L${libdir} -ludev
--Libs.private: -pthread
- Cflags: -I${includedir}
-diff --git a/udev_enumerate.c b/udev_enumerate.c
-index c553269..6fd49c0 100644
---- a/udev_enumerate.c
-+++ b/udev_enumerate.c
-@@ -21,7 +21,6 @@
- #include <string.h>
- #include <limits.h>
- #include <fnmatch.h>
--#include <pthread.h>
- 
- #include "udev.h"
- #include "udev_list.h"
-@@ -38,13 +37,6 @@ struct udev_enumerate {
-     int refcount;
- };
- 
--struct udev_enumerate_thread {
--    struct udev_enumerate *udev_enumerate;
--    pthread_mutex_t *mutex;
--    char path[PATH_MAX];
--    pthread_t thread;
--};
--
- int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem)
- {
-     return udev_enumerate ? !!udev_list_entry_add(&udev_enumerate->subsystem_match, subsystem, NULL, 0) - 1 : -1;
-@@ -231,31 +223,27 @@ static int filter_sysattr(struct udev_enumerate *udev_enumerate, struct udev_dev
-     return 1;
- }
- 
--static void *add_device(void *ptr)
-+static void add_device(struct udev_enumerate *udev_enumerate, const char *path)
- {
--    struct udev_enumerate_thread *thread = ptr;
-     struct udev_device *udev_device;
- 
--    udev_device = udev_device_new_from_syspath(thread->udev_enumerate->udev, thread->path);
-+    udev_device = udev_device_new_from_syspath(udev_enumerate->udev, path);
- 
-     if (!udev_device) {
--        return NULL;
-+        return;
-     }
- 
--    if (!filter_subsystem(thread->udev_enumerate, udev_device) ||
--        !filter_sysname(thread->udev_enumerate, udev_device) ||
--        !filter_property(thread->udev_enumerate, udev_device) ||
--        !filter_sysattr(thread->udev_enumerate, udev_device)) {
-+    if (!filter_subsystem(udev_enumerate, udev_device) ||
-+        !filter_sysname(udev_enumerate, udev_device) ||
-+        !filter_property(udev_enumerate, udev_device) ||
-+        !filter_sysattr(udev_enumerate, udev_device)) {
-         udev_device_unref(udev_device);
--        return NULL;
-+        return;
-     }
- 
--    pthread_mutex_lock(thread->mutex);
--    udev_list_entry_add(&thread->udev_enumerate->devices, udev_device_get_syspath(udev_device), NULL, 0);
--    pthread_mutex_unlock(thread->mutex);
-+    udev_list_entry_add(&udev_enumerate->devices, udev_device_get_syspath(udev_device), NULL, 0);
- 
-     udev_device_unref(udev_device);
--    return NULL;
- }
- 
- static int filter_dot(const struct dirent *de)
-@@ -265,9 +253,7 @@ static int filter_dot(const struct dirent *de)
- 
- static int scan_devices(struct udev_enumerate *udev_enumerate, const char *path)
- {
--    struct udev_enumerate_thread *thread;
--    pthread_mutex_t mutex;
--    int i, cnt, ret = 1;
-+    int i, cnt;
-     struct dirent **de;
- 
-     cnt = scandir(path, &de, filter_dot, NULL);
-@@ -276,41 +262,18 @@ static int scan_devices(struct udev_enumerate *udev_enumerate, const char *path)
-         return 0;
-     }
- 
--    thread = calloc(cnt, sizeof(*thread));
--
--    if (!thread) {
--        ret = 0;
--        goto free_de;
--    }
--
--    pthread_mutex_init(&mutex, NULL);
--
-     for (i = 0; i < cnt; i++) {
--        thread[i].mutex = &mutex;
--        thread[i].udev_enumerate = udev_enumerate;
--
--        snprintf(thread[i].path, sizeof(thread[i].path), "%s/%s", path, de[i]->d_name);
--
--        if (pthread_create(&thread[i].thread, NULL, add_device, &thread[i]) != 0) {
--            ret = 0;
--            break;
--        }
-+        char device_path[PATH_MAX];
-+        snprintf(device_path, sizeof(device_path), "%s/%s", path, de[i]->d_name);
-+        add_device(udev_enumerate, device_path);
-     }
- 
--    for (i = 0; i < cnt; i++) {
--        pthread_join(thread[i].thread, NULL);
--    }
--
--    free(thread);
--    pthread_mutex_destroy(&mutex);
--
--free_de:
-     for (i = 0; i < cnt; i++) {
-         free(de[i]);
-     }
- 
-     free(de);
--    return ret;
-+    return 1;
- }
- 
- int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate)
--- 
-2.47.3
-
package/libudev-zero/libudev-zero.hash +1 -1
index 4d8e19148a..fbff8e65e3 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256  0bd89b657d62d019598e6c7ed726ff8fed80e8ba092a83b484d66afb80b77da5  libudev-zero-1.0.3.tar.gz
+sha256  10148cfd6047d387bf71eca72cd19c177084224d96434a118d8def6e0a3d6316  libudev-zero-1.0.4.tar.gz
 sha256  9169cc15bda9e4597784ea29530d6754af6fb00adce5907bf0a794c575591d3f  LICENSE
package/libudev-zero/libudev-zero.mk +3 -2
index 5361a81b0a..ba41fe09f3 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-LIBUDEV_ZERO_VERSION = 1.0.3
+LIBUDEV_ZERO_VERSION = 1.0.4
 LIBUDEV_ZERO_SITE = $(call github,illiliti,libudev-zero,$(LIBUDEV_ZERO_VERSION))
 LIBUDEV_ZERO_LICENSE = ISC
 LIBUDEV_ZERO_LICENSE_FILES = LICENSE
@@ -12,7 +12,8 @@ LIBUDEV_ZERO_INSTALL_STAGING = YES
 LIBUDEV_ZERO_PROVIDES = libudev
 
 define LIBUDEV_ZERO_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS)
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+		PREFIX=/usr
 endef
 
 define LIBUDEV_ZERO_INSTALL_STAGING_CMDS
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/usbutils: only needs libudev, not udev daemon

From: Bernd Kuhls <[email protected]>

libudev-zero version 1.0.4 added support for usb.ids with commit
https://github.com/illiliti/libudev-zero/commit/2bebebc9e0444ec53afd7f1f37aa80ff6b95f5f7

---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/787f089f803e70db0e0a91dd6cb4ed5f319cb280

 package/libudev-zero/Config.in | 2 ++
 package/usbutils/Config.in     | 6 +++---
 package/usbutils/usbutils.mk   | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)
package/libudev-zero/Config.in +2 -0
index 41f1d762f1..92b56cfa10 100644
@@ -2,6 +2,8 @@ config BR2_PACKAGE_LIBUDEV_ZERO
 	bool "libudev-zero"
 	depends on !BR2_STATIC_LIBS
 	select BR2_PACKAGE_HAS_LIBUDEV
+	select BR2_PACKAGE_HWDATA if BR2_PACKAGE_USBUTILS # runtime
+	select BR2_PACKAGE_HWDATA_USB_IDS if BR2_PACKAGE_USBUTILS
 	help
 	  Daemonless replacement for libudev
 
package/usbutils/Config.in +3 -3
index 7e7029bbfe..ffc4104e7c 100644
@@ -2,7 +2,7 @@ config BR2_PACKAGE_USBUTILS
 	bool "usbutils"
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libusb
-	depends on BR2_PACKAGE_HAS_UDEV # needs hwdb
+	depends on BR2_PACKAGE_HAS_LIBUDEV
 	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
 	select BR2_PACKAGE_LIBUSB
 	help
@@ -10,7 +10,7 @@ config BR2_PACKAGE_USBUTILS
 
 	  http://linux-usb.sourceforge.net/
 
-comment "usbutils needs udev /dev management and toolchain w/ threads, gcc >= 4.9"
+comment "usbutils needs libudev and a toolchain w/ threads, wchar, dynamic library, gcc >= 4.9"
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || \
-		!BR2_PACKAGE_HAS_UDEV || \
+		!BR2_PACKAGE_HAS_LIBUDEV || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
package/usbutils/usbutils.mk +1 -1
index 5b6037afa2..afeb7ded2a 100644
@@ -7,7 +7,7 @@
 USBUTILS_VERSION = 019
 USBUTILS_SOURCE = usbutils-$(USBUTILS_VERSION).tar.xz
 USBUTILS_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/usb/usbutils
-USBUTILS_DEPENDENCIES = host-pkgconf libusb udev
+USBUTILS_DEPENDENCIES = host-pkgconf libudev libusb
 USBUTILS_LICENSE = GPL-2.0+ (utils) GPL-2.0 or GPL-3.0 (lsusb.py)
 USBUTILS_LICENSE_FILES = LICENSES/GPL-2.0-only.txt LICENSES/GPL-3.0-only.txt
 
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/usbutils: only needs libudev, not udev daemon

Hi Bernd,
one question below.

Quoted 20 lines · Bernd Kuhls

From: Bernd Kuhls <[email protected]>

libudev-zero version 1.0.4 added support for usb.ids with commit
https://github.com/illiliti/libudev-zero/commit/2bebebc9e0444ec53afd7f1f37aa80ff6b95f5f7

---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/787f089f803e70db0e0a91dd6cb4ed5f319cb280

  package/libudev-zero/Config.in | 2 ++
  package/usbutils/Config.in     | 6 +++---
  package/usbutils/usbutils.mk   | 2 +-
  3 files changed, 6 insertions(+), 4 deletions(-)
package/libudev-zero/Config.in +0 -0
index 41f1d762f1..92b56cfa10 100644

package/libudev-zero/Config.in config BR2_PACKAGE_LIBUDEV_ZERO · line 6

Quoted 5 lines
package/libudev-zero/Config.in +2 -0
@@ -2,6 +2,8 @@ config BR2_PACKAGE_LIBUDEV_ZERO
  	bool "libudev-zero"
  	depends on !BR2_STATIC_LIBS
  	select BR2_PACKAGE_HAS_LIBUDEV
+	select BR2_PACKAGE_HWDATA if BR2_PACKAGE_USBUTILS # runtime
+	select BR2_PACKAGE_HWDATA_USB_IDS if BR2_PACKAGE_USBUTILS

Is there a reason for putting these selects here into the libudev-zero config file instead of adding them into usb-utils?

package/libudev-zero/Config.in config BR2_PACKAGE_LIBUDEV_ZERO · line 8

Quoted 3 lines
package/libudev-zero/Config.in +0 -0
  	help
  	  Daemonless replacement for libudev
[...]

Best,
Marcus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

A message that is not in the archive (sent off-list or not yet received): 36dd2cd2-ef7f-4878-9dfc-d303fd6bd279__46984.2816515424$1781559163$gmane$org@bubu1.eu

#4 lore raw

Re: [Buildroot] [PATCH 2/2] package/usbutils: only needs libudev, not udev daemon

Am Mon, 15 Jun 2026 23:32:23 +0200 schrieb Marcus Hoffmann via buildroot:

Quoted 11 lines

package/libudev-zero/Config.in config BR2_PACKAGE_LIBUDEV_ZERO · line 6

Quoted 8 lines
package/libudev-zero/Config.in +2 -0
@@ -2,6 +2,8 @@ config BR2_PACKAGE_LIBUDEV_ZERO
  	bool "libudev-zero"
  	depends on !BR2_STATIC_LIBS
  	select BR2_PACKAGE_HAS_LIBUDEV
+	select BR2_PACKAGE_HWDATA if BR2_PACKAGE_USBUTILS # runtime
+	select BR2_PACKAGE_HWDATA_USB_IDS if BR2_PACKAGE_USBUTILS

Is there a reason for putting these selects here into the libudev-zero config file instead of adding them into usb-utils?

Hi Marcus,

both ways are possible but I opted for selecting the minimum set of packages because usbutils makes use of the hwdata package only when used with libudev-zero.

usbutils does not directly use usb.ids provided by hwdata, it calls udev_hwdb_*() functions which were only stubs in libudev-zero <= 1.0.3.

The other libudev providers, eudev and systemd, provide bundled versions of hwdata so they do not need to select our hwdata package.

libudev-zero 1.0.4 otoh does not bundle usb.ids, so in order to display meaningful infos we need the hwdata package.
Although it is true that reading usb.ids is an optional feature in libudev-zero[1] I opted to select hwdata to improve lsusb output but technically it is not mandatory so you can commit my patches without this part.

Regards, Bernd

[1] https://github.com/illiliti/libudev-zero/commit/
2bebebc9e0444ec53afd7f1f37aa80ff6b95f5f7

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Re: [Buildroot] [PATCH 2/2] package/usbutils: only needs libudev, not udev daemon

Hi Bernd,

thanks for the explanation. Series applied to master with one change, see below.

Quoted 14 lines · Bernd Kuhls

Am Mon, 15 Jun 2026 23:32:23 +0200 schrieb Marcus Hoffmann via buildroot:

Quoted 11 lines

package/libudev-zero/Config.in config BR2_PACKAGE_LIBUDEV_ZERO · line 6

Quoted 8 lines
package/libudev-zero/Config.in +2 -0
@@ -2,6 +2,8 @@ config BR2_PACKAGE_LIBUDEV_ZERO
   	bool "libudev-zero"
   	depends on !BR2_STATIC_LIBS
   	select BR2_PACKAGE_HAS_LIBUDEV
+	select BR2_PACKAGE_HWDATA if BR2_PACKAGE_USBUTILS # runtime
+	select BR2_PACKAGE_HWDATA_USB_IDS if BR2_PACKAGE_USBUTILS

Is there a reason for putting these selects here into the libudev-zero config file instead of adding them into usb-utils?

Quoted 5 lines

Hi Marcus,

both ways are possible but I opted for selecting the minimum set of packages because usbutils makes use of the hwdata package only when used with libudev-zero.

I moved these to usbutils when applying. It should have the same effect but I find it slightly less confusing to have the dependencies stated in the tool the user is actually selecting.>

Quoted 6 lines

usbutils does not directly use usb.ids provided by hwdata, it calls udev_hwdb_*() functions which were only stubs in libudev-zero <= 1.0.3.

The other libudev providers, eudev and systemd, provide bundled versions of hwdata so they do not need to select our hwdata package.

Quoted 6 lines

libudev-zero 1.0.4 otoh does not bundle usb.ids, so in order to display meaningful infos we need the hwdata package.
Although it is true that reading usb.ids is an optional feature in libudev-zero[1] I opted to select hwdata to improve lsusb output but technically it is not mandatory so you can commit my patches without this part.

It would indeed be nice to have "recommends" level dependencies in buildroot.
After a bit of back and forth I decided to keep these dependencies. The hwdata usb ids aren't exactly tiny, but my main argument in favour of having this dependency is that if you want a tiny lsusb and aren't interested in having the hw database available you can still use the busybox version and just not install usbutils.

Quoted 2 lines

Regards, Bernd

Best,
Marcus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot