I’m trying to use the Adafruit_Blinka Python library in order to get readings from one of Adafruit’s IMU products. My goal with this post is to understand if sudo is required in order to simply read from the IMU; ideally I can run a python script without sudo to get readings. The IMU itself isn’t relevant here, but rather using the Adafruit_Blinka library.
I found this github issue on using the Adafruit libraries to properly detect a BeagleBone Black on 5.10 kernel: BeagleBone Black is not detected properly on kernel 5.10 and later · Issue #218 · adafruit/Adafruit_Python_PlatformDetect · GitHub
@RobertCNelson even weighed in and it looked like this particular issue was solved for Debian Buster images. However, I have a BeagleBone Green with the Debian 12.2 Bookworm image.
I was eventually able to run python -c "import board"
successfully (no sudo) but it took some digging. I had to make a modification in order to run import board
without a PermissionError
to read the nvmem file. I found this comment here
However, I didn’t seem to have a /etc/udev/rules.d/80-eeprom-noroot.rules
file so I made one as detailed here: Beagle Bone Black: no such file or directory: 0-00500/nvmem, permission denied 0-00500/nvmem · Issue #886 · adafruit/Adafruit_Blinka · GitHub
I guess I’m troubled by having to do this just to run all this without sudo. I have a solution now, but it felt icky. Should I not have to make this change? Perhaps this deserves a new PR to the Adafruit_Python_PlatformDetect library? Or should I just suck it up and find a way to live with sudo in this case?
Thanks.