Jetson.GPIO permissions with Yocto build

Hello,

I’m working on creating an image for the Nano using the Yocto Project and Bitbake. As part of that, I’m trying to include Jetson.GPIO in the image at builtime.

I have the following recipe for the package

SUMMARY = "Recipie to embedded the Python PiP Package Jetson.GPIO"
HOMEPAGE ="https://pypi.org/project/Jetson.GPIO"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://PKG-INFO;md5=a8fc9772bcd540559bdffee9f34755e7"

inherit pypi setuptools3
PYPI_PACKAGE = "Jetson.GPIO"
SRC_URI[md5sum] = "a2ade30de4627f724f98843eca0e222d"
SRC_URI[sha256sum] = "f5d1103bbc2701c0b1603d31ea9043ca9ab670d6204846aa2ff25c2302c91fdc"

This installs the package correctly, but user permissions are still a bit weird. I can confirm that I’ve created a group called “gpio” and that the user is a member using the groups command.

Running the following shows permissions on export/unexport

--w-------    1 root     root          4096 Feb  7 15:50 /sys/class/gpio/export

If I try importing the package in python, I receive a permissions issue saying the user does not have permissions. However it works if I run python with sudo.

I’ve attempted copying 99-gpio.rules into /etc/udev/rules.d and have run the command to reload and trigger the rule change. Still doesn’t work though.

The only success I’ve had is if I attempt to run the bash commands listed inside the 99-gpio.rules file manually. After this, the user has gpio function without sudo

I can always switch it to a more manual install and installing from source, but just felt the pypi method would be easier. Any thoughts?

Note: image is based on core-image-minimal and uses meta-tegra for the hardware bsp.

Can provide any other information on the build as needed! Thanks guys.

Edit I went ahead and tried installing using sudo python3 setup.py install and copying over the rules before running the udevadm commands. Still not working

Edit 2 So I realized that meta-tegra doesn’t expose the spidev device and there was a line in 99-gpio.rules that affects this device. By commenting out the line, copying it over into rules.d and running reload/trigger + a restart it’s working properly. Still a bit weird

hello bsmerbeck,

besides working with Jetson-GPIO, could you please enable GPIOs manually.
please refer to below as examples,

* Location of the GPIOs
$ cd /sys/class/gpio

* Generate gpio220 name
$ echo 220 > export

* Enable GPIOs
$ echo out > direction 
$ echo 1 > value 

you may also refer to GPIO Changes session to translate from SOM-connector pins to actual GPIO numbers.
thanks