-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Update generic_gpio_libgpiod driver to latest libgpiod versions. #2833
Comments
Thanks for the report. Apparently none of the CI farm systems, including those in GHA and similar providers who define the OS we get, exposed this to be a problem. Maybe they don't have the library at all and build @modrisb : would you have a chance to look at this anytime soon? (I hope to finish one other PR and cut a release to slip into distros' release window, so it is a matter of hours/days to fix before that too...) @tomeko12 : can you suggest which distro/release this problem can be triggered on? |
I took a quick look at it, and it seems the v2.x revamp of https://web.git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ / https://github.com/brgl/libgpiod was even bigger than libusb0 going to libusb1 (where most of the concepts were equivalent but with different names and data types). Here it is (or seems to be) like a separate project dabbling in the same area as libgpiod v1.x Still, a separate distro is not so much needed, a custom build and install of the library suffices for attempts to support either API:
And in NUT build area:
|
FWIW, some good history (and pointers about future) here: And some precedent update to new API in another randomly googled project: |
…ure to C code of WITH_LIBGPIO_VERSION [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ools#2833] Should also serve for actual fix of the drivers for new libgpio API, but not sure if that would land in NUT v2.8.3 timeframe or after the release. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ure to C code of WITH_LIBGPIO_VERSION [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ools#2833] Should also serve for actual fix of the drivers for new libgpio API, but not sure if that would land in NUT v2.8.3 timeframe or after the release. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Laid some groundwork to detect the libgpiod variant and provide the fixes, but not sure I'd be able to follow up on those quickly (I don't have time now to understand the API changes responsibly, nor hardware to test against). A commit would be very welcome to complete the PR, feel free to use the https://github.com/jimklimov/nut/tree/issue-2833 branch as the starting point. Currently the configuration passes, newly introduced
|
@jimklimov not clear yet what would be the best solution: add ifdef's to generic_gpio-gpiolib.c to build for both library versions or create generic_gpio-gpiolib2.c to be used with v2 library. Probably 1st is possible, but may require significant rework and testing. |
Well, it depends on how large the API difference is. I hoped for a dozen tactical ifdef's to solve the issue, if most of the other logic remains. Easier to keep the two variant builds in sync this way, going forward (new NUT on older distros). |
@jimklimov I have some progress with changes to support v2, but need more time for testing, hope will have by Monday. Test tools might be under questions as needs new mock for library. Let me know if see reason to publish recent code to git. |
Sounds encouraging, thanks! If it is buildable in at least one case, makes sense to push and check by CI (although that would mostly reveal that ifdef's did not break syntax for existing platforms). Maybe we can add a scenario using (packaged or locally built) libgpiod2 for more relevant checks too :) but I'll be also away for the weekend or much of it. CC @mbiebl @bgermann : sorry for poking you guys - when is the Debian/Ubuntu packaging freeze for April releases, and how strict is it? Any chance of NUT v2.8.3 making it there if released e.g. next week, or is it too late already?.. |
I do not use nut myself, just fixed a trivial bug that would have kept the existing package version from being released with trixie. For Ubuntu, I do not know the date, for Debian it is April 15th, so the new package version should enter on the 5th at the latest. If a SONAME bump (and with it, a package rename) is involved, you are probably out of luck. The right place to discuss this is the Debian bug. |
I opened pull request for solution. Test suite executed for both library versions, manual run of driver on RaspberryPi0 2 also for both versions. |
Super! For posterity, that's a PR against my fork at jimklimov#6 - just as a master to master increment, without the libgpio version detection I proposed earlier. @modrisb : I think I will pick your changes into the branch I did prepare, if only to make this variation more visible at build and in troubleshooting. One thing that looks odd to me is that both old and new UPDATE: I was wrong about PS: It was also an unconventional choice of workflow to make a new fork and post a PR from its |
… WITH_LIBGPIO_VERSION_STR a driver was built against [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…WITH_LIBGPIO_VERSION [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
How did you checked presence of define for GPIOD_API? V2 git installation adds gpiod.h to /usr/local/include and not to /usr/include, may that's a trick? I lost at least hour on that. I added to code printout that depends on this define and got proper printouts. Sorry for workflow - not doing this often and again mixed up. |
I Actually seen in git too:
UPDATE: Oh, I see now that this was in an |
… WITH_LIBGPIO_VERSION_STR a driver was built against [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…WITH_LIBGPIO_VERSION [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
I'm preparing the branch with your and my changes together, checking locally that the two builds pass and will post a PR to upstream NUT - would be grateful if you can test that against HW too :) |
…implementations [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…TH_LIBGPIO_VERSION [networkupstools#2833] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov what would be right way to get code for testing? |
|
@jimklimov v2 works fine, except test tool prints lib version in decimal as 131072 (0x00020000); the same for v1 - tests and driver run is ok. Probably to replace in tests/generic_gpio_utest.c But plain decimal 1 or 2 would be more informative and clear. |
Aha, missed that hex :\ Thanks for checking! Your initial post mentioned issues with v1 build - was that an operator error? :) |
I did not properly cleared build before v1 - my fault. |
Hi.
Please update generic_gpio_libgpiod driver to latest libgpiod versions.
Currently, this driver require libgpiod version 1.x.x (latest is 1.6.5), but newest distribution don't include this version, 2.x.x only (latest is 2.2.1), and driver can't be build.
The text was updated successfully, but these errors were encountered: