BeagleBone Green + Adafruit_Blinka Python Library Permissions (Debian 12.2 Bookworm)

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.

I just looked at their site, very impressive sensor, have not worked with that one. It is i2c. It says the sensor has absracted out the math using an arm core. That would imply to me it is sending out positional data that can be implemented as is. You might have to do some homework on this and find out how its framing up the data and just write your own code in c++ then convert it into a python module.

page 102 has the i2c info

$groups

If your board has an i2c group add it to your user.

You can also set the permissions to test it.

$sudo chmod 666 /dev/i2c-1

FYI, 666 is testing only, change it back after testing.

If that works, you can create udev rule for it.