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

Bind to explicit major version of libgpiod - Try 2 #2120

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented Aug 17, 2023

Fixes #1070

This is essentially trying to use version 2.0 of libgpiod to remove the need of installing the -dev package, and adds some logic in the case that version 2.0 is not found so that it can instead look for version 1.6. This was inspired by @Tragetaschen comment on the first attempt PR, as well as following precedence to a very similar change that was made in dotnet/runtime solving a very similar situation.

cc: @pgrawehr @raffaeler @Ellerbach

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-System.Device.Gpio Contains types for using general-purpose I/O (GPIO) pins label Aug 17, 2023
Copy link
Contributor

@raffaeler raffaeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Good to see the uppercase refactoring as well.

static Libgpiod()
{
InvalidHandleValue = new IntPtr(-1);
#if NET6_0_OR_GREATER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to double check; with any other version, we will have the existing behavior, right? In that case, looks all good to me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following line is what always existed in current versions:

        private const string LibgpiodLibrary = "libgpiod";

This line of code will now used only for netstandard (which we basically use only for Mono on Linux).

@joperezr joperezr merged commit b135f81 into main Aug 18, 2023
9 checks passed
@joperezr joperezr deleted the joperezr/LibGpiodLib branch August 18, 2023 22:45
@krwq
Copy link
Member

krwq commented Aug 23, 2023

nice job figuring this out!

@raffaeler raffaeler mentioned this pull request Nov 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Device.Gpio Contains types for using general-purpose I/O (GPIO) pins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include the major version when referencing *.so libraries
5 participants