[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[libbladerf2] Change udev rule to add plugdev group



Hello all,

Currently the udev rules for the BladeRFs (`SUBSYSTEM=="usb", ATTR{idVendor}=="2cf0", ATTR{idProduct}=="5250", ENV{ID_SOFTWARE_RADIO}="1", TAG+="uaccess"`) do two things:
- Set the ENV ID_SOFTWARE_RADIO to 1
- Add the uaccess TAG

The second action is redundant with the first, as the rule in `/usr/lib/udev/rules.d/70-uaccess.rules`: `ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess"`, already adds the uaccess TAG when ID_SOFTWARE_RADIO is set to 1.

I see 3 problems:
- There is no way to give a remote user or an automated non-root script access to the device without overriding the udev rule
- The uaccess TAG only gives access if the device is already connected on login
- It is not aligned with the udev rules for other SDR devices

Aligning the BladeRF2 rules to  how it is done for rtl-sdr or hackrf devices for example:
```
❯ diff -ruN /usr/lib/udev/rules.d/88-nuand-bladerf2.rules.orig /usr/lib/udev/rules.d/88-nuand-bladerf2.rules
--- /usr/lib/udev/rules.d/88-nuand-bladerf2.rules.orig 2024-07-02 22:29:58.082122124 +0200
+++ /usr/lib/udev/rules.d/88-nuand-bladerf2.rules 2024-07-02 22:30:11.938186142 +0200
@@ -1,2 +1,2 @@
 # Nuand bladeRF 2.0 micro
-SUBSYSTEM=="usb", ATTR{idVendor}=="2cf0", ATTR{idProduct}=="5250", ENV{ID_SOFTWARE_RADIO}="1", TAG+="uaccess"
+SUBSYSTEM=="usb", ATTR{idVendor}=="2cf0", ATTR{idProduct}=="5250", ENV{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"
```

Would solve my issues. It still works the same as before for the currently logged in user, in addition we can put any user into the plugdev group to give access.

I'd happily propose a merge request on https://salsa.debian.org/debian-hamradio-team/bladerf/-/blob/debian/debian/patches/update-bladerf-udev-rules?ref_type=heads
if I had access.
Also I expect this proposal might not make everyone happy so I prefer start the discussion here.

Thanks and best regards,

Martin Herren

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to:
OSZAR »