0

This Q reflects some of the reservations expressed in another Question here. I too have questions re "The future of GPIO access on Pi 5"; hopefully, the questions here are answerable questions:

While researching my question, one of the references that attracted my attention was this post by 6by9 in the RPi forum:

libgpio is the correct answer for any variant of Pi now. There should be no need to directly bash registers through gpiomem holes at all.

  • This statement is baffling to me. AFAICS, libgpio has been abandoned - the main GitHub site hasn't been touched in 6+ years, AND apt-cache search libgpio shows nothing but libgpiod stuff.

  • Worse, the libgpiod status in the RPi repositories is unclear. This link to the kernel website clearly shows that version 2.1 is the latest. From my RPi5, I can see a package called libgpiod2, yet when it's installed, it says this:

sudo apt install libgpiod2 libgpiod-doc libgpiod-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgpiod2 is already the newest version (1.6.3-1+b3). ## <=== wtfo?
libgpiod-doc is already the newest version (1.6.3-1).
libgpiod-dev is already the newest version (1.6.3-1+b3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • How does an old version of libgpiod (1.6.x) come to be called by the package name of libgpiod2?? And of course, the examples for version 2 are incompatible with the 1.6.x version library, and do not compile.

Does anyone know what's going on with GPIO programming for RPi 5? (not interested in the Python stuff - thanks anyway). Has there been some sort of rift between RPi & Linux devs? Have I inadvertently retrograded my libgpiod library to ver 1.6 by installing libgpiod2? I am truly confused.

Seamus
  • 23,558
  • 5
  • 42
  • 83

3 Answers3

1

Personally, I get lost fast in all these similar-sounding libraries, low-level interfaces and language-specific utilities. It all drove me to make a utility with a file-based interface. Poke or read a file to set or get a value. The end.

For someone wanting to do LEDs and buttons, it seems great. Everything is at a much higher level, and management seems simple.

There is a bit more to it. You fill out a config file that maps GPIO pins to the active (non-ground) leads in your buttons and LEDs. Also, there are "programs" to allow time based behavior like a blinking LED.

In our case, programs were great. They allow us to communicate to the user, so we expanded up to 60 of them.

BTW, this runs in the background with SystemD so your application can read and write to specified files and it does all the GPIO handling in the background.

Does this run on the Pi5? I think it should. If it doesn't, I need to make it work. Open an issue at the repo: https://github.com/briantbutton/plebgpio If there is some interest, I would enjoy making it into a Debian package.

0

yes, this is very confusing. maybe libgpiod should really be called tools-gpiod or something. it doesn't actually seem to provide a library as such anywhere. there's probably a temporary compile somewhere to

apt show gpiod version : 1.6.3-1+b3 source : libgpiod (1.6.3-1) depends : libgpiod2 (>= 1.5.1)

apt show python3-libgpiod version : 1.6.3-1+b3 source : libgpiod (1.6.3-1) depends : libgpiod2 (= 1.6.3-1+b3)

I think the python3-libgpiod depends is in error as the version number suggests it's referring to libgpiod

libgpiod2 installs to /lib/aarch64-linux-gnu/libgpiod.so.2.2.2

I can't find anything that looks like libgpiod.so or libgpiod.a anywhere. Although if you "apt install libgpiod-dev", then you will get /usr/include/gpiod.h

Very confusing indeed.

0

I can't answer all of the questions I posed here, but I think I've gotten the important ones:

  • The Q re. "this post by 6by9 in the RPi forum" was simply a typo by the author; i.e. I think he meant libgpiod but he wrote libgpio.

  • I think that the version numbering discrepancy ("how did libgpiod (1.6.x) come to be called by the package name of libgpiod2??") is down to a Debian thing wrt their numbering convention.

I tried to delete my question, but as it now has answers I was unable to do so. Apologies to all for flying off the handle - I live and learn.

Seamus
  • 23,558
  • 5
  • 42
  • 83