Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate GPIO usage to libgpiod Python bindings #43

Closed
pdp7 opened this issue Oct 22, 2018 · 5 comments
Closed

migrate GPIO usage to libgpiod Python bindings #43

pdp7 opened this issue Oct 22, 2018 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@pdp7
Copy link
Collaborator

pdp7 commented Oct 22, 2018

RPi.GPIO and Adafruit_BBIO both use the legacy /sys interface for the Linux kernel GPIO subsystem.

libgpiod is a userspace library by @brgl that use the new character device based interface for Linux kernel GPIO subsystem.

The sysfs interface for GPIO is marked as deprecated in the Linux kernel, so I believe this Blinka library should migrate to the libgpiod Python bindings.

View Adafruit_BBIO issue #157 for more information on the character device interface in the Linux kernel.

cc @brennen

@pdp7 pdp7 self-assigned this Oct 22, 2018
@ladyada
Copy link
Member

ladyada commented Oct 22, 2018

that would be awesome - its definitely something we'd like to do (and libgpiod is a lil faster too)

@pdp7 pdp7 added the enhancement New feature or request label Oct 22, 2018
@brennen
Copy link
Contributor

brennen commented Nov 9, 2018

Hey @pdp7 - do you have any input on packaging / availability of libgpiod? I'm kind of in over my head on this, but it seems like anything we do with Blinka is going to require that it be trivially available on a standard Raspbian install, at minimum.

It looks like there'll eventually be a Debian package, but that presumably won't trickle through to Raspbian for quite a while.

Have thought about:

  • distributing a deb package - we've been down that road before and just didn't find it especially tenable long term. Even if we didn't have to maintain the package ourselves and could just piggyback on Debian work, it's one more complication for users and we could really stand to avoid the barriers to entry.
  • building wheels that contain library binaries - seems kind of gnar.
  • distributing libgpiod source with Adafruit_Blinka (or downloading at install time), compiling on install from PyPI. I know this is probably do-able (assuming no license issues), but really seems like it ought to be its own self-contained dependency.

Practically speaking, it'd probably be optimal until it's available in more distros if there were just a libgpiod package on PyPI that provided library and bindings... Any thoughts?

@ladyada
Copy link
Member

ladyada commented Dec 2, 2018

done here #59
turns out there's no pullup support, which is makes it a poor substitute for well-written GPIO bindings, but its good for poorly-supported chips w/only sysfs
anywyas for now i just tell people to run the script on import failure. i think thats fine until libgpiod is shipped with

@ladyada
Copy link
Member

ladyada commented Dec 3, 2018

is in generic_linux

@ladyada ladyada closed this as completed Dec 3, 2018
@theyoyojo
Copy link

Hey, I've been working on a drop-in replacement for RPi.GPIO that uses libgpiod's python bindings as the underlying GPIO access mechanism instead of /dev/mem or the sysfs interface.

I see that this issue was closed long ago but I figured I'd mention this library's existence in case anyone here finds it useful.

Pending my latest pull request the library is feature complete if not very close to it, i.e. it completely re-implements the RPi.GPIO API as of RPi.GPIO version 0.7.0

Here is the repo: https://github.com/underground-software/python3-libgpiod-rpi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants