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

Required version of libgpiod? #25

Open
splitice opened this issue Mar 6, 2024 · 10 comments
Open

Required version of libgpiod? #25

splitice opened this issue Mar 6, 2024 · 10 comments
Labels
bug Something isn't working gpiod-1.x all related to underlying libgpiod-1.x series help wanted Extra attention is needed tests some kind of test (unit, functional, real hardware) is needed

Comments

@splitice
Copy link
Contributor

splitice commented Mar 6, 2024

Potential min libgpiod version or ifdefs required.

../src/line.cc:24:99: error: ‘GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE’ was not declared in this scope; did you mean ‘GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN’?
   24 |   Nan::Set(lineFlags, Nan::New("GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE").ToLocalChecked(), Nan::New(GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE));
      |                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                   GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN
../src/line.cc:25:101: error: ‘GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN’ was not declared in this scope; did you mean ‘GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW’?
   25 |   Nan::Set(lineFlags, Nan::New("GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN").ToLocalChecked(), Nan::New(GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN));
      |                                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                     GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW
../src/line.cc:26:99: error: ‘GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP’ was not declared in this scope; did you mean ‘GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW’?
   26 |   Nan::Set(lineFlags, Nan::New("GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP").ToLocalChecked(), Nan::New(GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP));
      |                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                   GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW

Havent yet dug into libgpiod to work out the required version.

@sombriks
Copy link
Owner

sombriks commented Mar 6, 2024

Hi @splitice !
Indeed there is a new version of libgpiod in streets and we intend to maintain both.

in this repo there is main-1.x branch which is supposed to work with libgpiod 1.x series and main-2.x branch for the new version.

the 2.x series will introduce breaking changes because libgpiod itself changed, and we'll try to mirror the original api as much as possible.

please check which libgpiod version your system have; if your kernel is updated it is most likely you will need to wait for a 2.x release

@sombriks sombriks added help wanted Extra attention is needed dependencies Pull requests that update a dependency file labels Mar 6, 2024
@splitice
Copy link
Contributor Author

It might be best to use ifdefs to make a dual compatible version?

From a project maintenance point of view its a metric PITA for our developers with a different version of libgpiod to the production system during development. And I've checked debian doesnt have a stable release with libgpiod 2.x yet.

Even ifdef on GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP for 1.x that should be fine?

@splitice
Copy link
Contributor Author

splitice commented Mar 28, 2024

I got to say ubuntus versioning on libgpiod ("2") is very confusing.

I'm on 20.04 (LTS) for development.

Package: libgpiod-dev
Architecture: amd64
Version: 1.4.1-4
[...]
Depends: libgpiod2 (= 1.4.1-4)
Suggests: libgpiod-doc
Filename: pool/universe/libg/libgpiod/libgpiod-dev_1.4.1-4_amd64.deb

I thought you were right initially but instead it looks like the version is 1.4, perhaps 1.4 is too old?

Those defines were added in 2019 and are not in v1.4.0. I would confirm this against the source repository at kernel.org, however I'm getting 403's currently. I confirmed it however against a github mirror.

This means that we perhaps need either to ifdef these exposed defines, or raise the documented supported version in the README

@splitice
Copy link
Contributor Author

Can confirm v1.6.3 (package from ubuntu 22.04) contains the required definitions.

@sombriks
Copy link
Owner

just to be clear, the definitions are missing from index.d.ts in 1.x branch, is that correct?

@splitice
Copy link
Contributor Author

Huh? No.

You either need some ifdefs to support v1.4, or to add a min requirement in the README for v1.5.

@sombriks sombriks added gpiod-1.x all related to underlying libgpiod-1.x series bug Something isn't working and removed help wanted Extra attention is needed dependencies Pull requests that update a dependency file labels Apr 6, 2024
@sombriks
Copy link
Owner

sombriks commented Apr 6, 2024

Hi @splitice !
It take a while but i managed to try something to solve it.

The first attempt is indeed to add a compile flag so i can proper setup it in the future.

If possible, please check if it works again with older libgpiod (prior to 1.5) and let me know!

@sombriks sombriks added the help wanted Extra attention is needed label Apr 6, 2024
@splitice
Copy link
Contributor Author

splitice commented Apr 9, 2024

TypeError: Cannot read properties of undefined (reading 'GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW')

This is on debian bookworm libgpiod2 1.6.3 which does have those flags

@sombriks
Copy link
Owner

sombriks commented Apr 9, 2024

Hey @splitice , thanks for the feedback, looks like it's time to debian virtual machine then! i'll figure out what's the issue.

@sombriks
Copy link
Owner

Hello @splitice ,

i moved the enums definition to javascript side of the code; i hope this change makes transparent for the node binding if it's being built against 1.4, 1.5 or 1.6 libgpiod version.

when you have a chance please run some tests using the 0.4.5 version from npm, or even checking test cases against gpio-sim setup (not perfect yet, but try it out if your environment sits in the sweet spot of having the gpio-sim kernel module and libgpiod version prior to 2.0).

@sombriks sombriks added the tests some kind of test (unit, functional, real hardware) is needed label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gpiod-1.x all related to underlying libgpiod-1.x series help wanted Extra attention is needed tests some kind of test (unit, functional, real hardware) is needed
Projects
None yet
Development

No branches or pull requests

2 participants