cdump / radiacode

Library for RadiaCode-101
MIT License
101 stars 18 forks source link

USBError UDEV rules? #11

Open assada opened 1 year ago

assada commented 1 year ago
$ python3 -m radiacode-examples.basic

usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
$ lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0483:f123 STMicroelectronics RadiaCode-101
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ cat /lib/udev/rules.d/50-radiacode.rules

# Radiacode-10X radiation detector
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="f123", ATTRS{manufacturer}=="AngioScan", TAG+="uaccess", MODE="0660"
cdump commented 1 year ago

What is your OS, is it systemd-based?

This udev rule should work

assada commented 1 year ago

RPI4 Debian based latest raspbian os

$ lsb_release -a 
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye
$ uname -a
Linux home-serve 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

I removed the manufacturer and set MODE="0777" and now its ok for me

$ cat /lib/udev/rules.d/50-radiacode.rules
# Radiacode-10X radiation detector
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="f123", TAG+="uaccess", MODE="0777"
ckuethe commented 7 months ago

It does appear that the manufacturer name has changed, so removing the manufacturer condition is a good choice.

You don't need to set the x permissions, so 0666 is wide open. If you check your group membership (with id or groups) combined with udev matching on just the usb id, you shouldn't need to make it wide open.