Trouble using gpiod library to control gpio pins in release container

Hello,

I am currently trying to deploy a release container that utilizes the gpio pins via the gpiod python library. However, when I attempt to turn on the gpio pins the gpiod library throws an error “OSError: [Errno0] success: error creating gpio chip iterator”. When I run the container using debug mode from VScode it works as expected.

I am including /dev/gpiochip0 under devices and /dev under volumes. I also added this command to the dockerfile based on some examples on the website:
RUN usermod -a -G gpio torizon

It seems like /dev is not getting populated fully inside of the container when I bind mount it:

Any help is appreciated. Thanks!

I am running:
torizoncore 5.7.0
apalis imx8
ixora carrier board v1.2

Greetings @MikeHA,

Just to make sure I understand, are you launching the release container from the VSCode extension as well? Or are you manually launching it from the command-line yourself?

Though based on your screenshot it would appear that your assessment is correct and that the bind-mount to dev isn’t working for some reason.

Best Regards,
Jeremias

Hi Jeremy,

I was building the release container and then using a docker-compose file to launch it.

I did find the error. When using the gpiod library and specifically the find_line function. It iterates through all of the gpiochips to look for that line. Therefore, you have to include all the gpiochips(in the imx8 case 0-9) in devices for that to work properly.

Thanks!

Glad you were able to solve your issue.

I did find the error. When using the gpiod library and specifically the find_line function. It iterates through all of the gpiochips to look for that line.

Interesting that’s how it works, though good to know for future reference.

Best Regards,
Jeremias