Skip to content

Add libgpiod v2 support and fix Pi 5 compatibility#150

Merged
momenso merged 7 commits intomasterfrom
feature/libgpiod_v2
Apr 18, 2026
Merged

Add libgpiod v2 support and fix Pi 5 compatibility#150
momenso merged 7 commits intomasterfrom
feature/libgpiod_v2

Conversation

@momenso
Copy link
Copy Markdown
Owner

@momenso momenso commented Apr 18, 2026

The existing libgpiod path only supported the v1 API, which is incompatible with Raspberry Pi OS on Debian 12+ where libgpiod v2 is the default. This PR adds full v2 support alongside the existing v1 path, with the version selected automatically at build time.

  • We now use pkg-config to detect the installed libgpiod major version at configure time and sets GPIOD_V1 or GPIOD_V2 accordingly. bcm2835.c is excluded from the build when --use_libgpiod=true is passed.

  • The v2 path uses the new gpiod_chip_request_lines API with OPEN_DRAIN output mode, which is required for the single-wire DHT protocol on the RP1 southbridge. GPIO chip discovery now enumerates available chips by their kernel label (pinctrl-rp1) , with a device-path fallback for forward compatibility. The v1 path is updated to release and re-request lines on direction change for compatibility with libgpiod < 1.5.

  • Installation section restructured to clearly separate the Pi 5 / libgpiod path from the default BCM2835 path. Node.js installation appendix updated to use NodeSource.

Closes #149.

@momenso momenso merged commit f3902b6 into master Apr 18, 2026
3 checks passed
@momenso momenso deleted the feature/libgpiod_v2 branch April 18, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libgpiod v2 API incompatibility breaks build on Raspberry Pi 5 (Raspberry Pi OS / Debian Trixie)

1 participant