Fix Pi 5 driver selection crash when only libgpiod.so.3 is installed#2490
Open
Fix Pi 5 driver selection crash when only libgpiod.so.3 is installed#2490
Conversation
…so.3 is installed - Add Pi 5 rev 1.1 firmware code (0x4171) to board model mapping - Fix Pi 5 driver selection to try LibGpiodDriver (V1/libgpiod.so.2) first, then fall back to LibGpiodV2Driver (V2/libgpiod.so.3), matching the graceful fallback pattern used elsewhere in the codebase Agent-Logs-Url: https://github.com/dotnet/iot/sessions/a5e2c635-cb09-4a00-a38e-62450f138d7a Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix inconsistent behavior for Pi 5 rev 1.0 and 1.1
Fix Pi 5 driver selection crash when only libgpiod.so.3 is installed
Apr 2, 2026
Contributor
|
@copilot Instead of duplicating the logic of GpioDriver.Create() try to use a common function. |
…of duplicating try/catch logic Agent-Logs-Url: https://github.com/dotnet/iot/sessions/935a874e-b4c1-454d-ae3d-f30aa5eb8da6 Co-authored-by: pgrawehr <13809874+pgrawehr@users.noreply.github.com>
Contributor
Author
Manuelmm333
approved these changes
Apr 11, 2026
krwq
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
RaspberryPi5case inGetBestDriverForBoardOnLinux()hardcodesLibGpiodDriver.GetAvailableChips()(V1 ABI, requireslibgpiod.so.2), which crashes on recent Pi OS images that only shiplibgpiod.so.3. Meanwhile, unmapped Pi 5 revisions fall through toUnixDriver.Create()which handles this gracefully — so rev 1.0 crashes but rev 1.1 works.Changes
GpioController.cs: Pi 5 case now usesGpioDriver.TryCreate()to tryLibGpiodDriver(V1) first, then fall back toLibGpiodV2Driver(V2 ABI), reusing the same common function already used byUnixDriver.Create(). A smallCreatePi5Driverhelper finds the RP1 chip (54 lines) and creates the driver via a factory delegate.RaspberryBoardInfo.cs: Added firmware code0x4171(Pi 5 rev 1.1) to theRaspberryPi5mapping so it gets proper Pi 5 driver selection instead of falling through toUnknown