[Buildroot] [git commit branch/next] package/libsigrok: install udev rules

Peter Korsgaard peter at korsgaard.com
Fri Feb 28 16:43:25 UTC 2025


commit: https://git.buildroot.net/buildroot/commit/?id=dad34a1a22a3b52d3ef2f014640e5155f84db0ad
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

Some devices that libsigrok can talk to, need a firmware to be uploaded.
libsigrok comes with a set of rules to allow non-root users to upload
those firmware blobs.

Depending on how the system is configured, different set of rules are
needed [0] (yes, it's documented on the fx2lafw page, not on the
libsigrok one [1]). Basically:

  - 60-libsigrok.rules is always used;
  - 61-libsigrok-uaccess.rules is used when systemd-logind is used;
  - 61-libsigrok-plugdev.rules is used when systemd-logind is not used.

For systems without udev, it is the responsibility of the user to
implement proper access management if they need non-root to upload
firmware files.

[0] https://sigrok.org/wiki/Fx2lafw#Install_the_udev_rules_file
[1] https://sigrok.org/wiki/Libsigrok

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/libsigrok/libsigrok.mk | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/package/libsigrok/libsigrok.mk b/package/libsigrok/libsigrok.mk
index 639ee4dc25..22524dd4f6 100644
--- a/package/libsigrok/libsigrok.mk
+++ b/package/libsigrok/libsigrok.mk
@@ -65,4 +65,20 @@ else
 LIBSIGROK_CONF_OPTS += --disable-cxx
 endif
 
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+LIBSIGROK_UDEV_RULES = \
+	60-libsigrok.rules \
+	$(if $(BR2_PACKAGE_SYSTEMD_LOGIND), \
+		61-libsigrok-uaccess.rules, \
+		61-libsigrok-plugdev.rules \
+	)
+define LIBSIGROK_INSTALL_UDEV_RULES
+	$(foreach rule, $(LIBSIGROK_UDEV_RULES), \
+		$(INSTALL) -D -m 0644 $(@D)/contrib/$(rule) \
+			$(TARGET_DIR)/usr/lib/udev/rules.d/$(rule)$(sep) \
+	)
+endef
+LIBSIGROK_POST_INSTALL_TARGET_HOOKS += LIBSIGROK_INSTALL_UDEV_RULES
+endif
+
 $(eval $(autotools-package))


More information about the buildroot mailing list