Firmware code 0xD04171 (Pi 5 rev 1.1) is not mapped in RaspberryBoardInfo.GetBoardModel() and thus the argument-less GpioController constructor which invokes GetBestDriverForBoardOnLinux() falls back to UnixDriver.Create()
|
return UnixDriver.Create(); |
which tries to relatively safely auto-detect libgpiod version or to fall back to sysfs driver. So on Pi 5 rev 1.1 we have no crash when only libgpiod.so.3 is installed which is the case with some recent Pi OS images.
On the other hand, firmware code 0xD04170 (Pi 5 rev 1.0) is mapped so GetBestDriverForBoardOnLinux() tries to invoke
|
var chips = LibGpiodDriver.GetAvailableChips(); |
which leads to crash in absense of libgpiod.so.2.
Thus the same binary or image deployed on different Pi 5 revisions eventually behaves different ways.
Steps to reproduce
Invoke
_ = new GpioController();
on Pi 5 rev 1.0 and 1.1 separately on the same image.
We've used Raspberry Lite OS 64-bit image dated March 2026 which only contains these versions of libgpiod:
$ sudo find /usr/lib -name "*libgpiod*"
/usr/lib/aarch64-linux-gnu/libgpiodcxx.so.2.1.0
/usr/lib/aarch64-linux-gnu/libgpiod.so.3
/usr/lib/aarch64-linux-gnu/libgpiod.so.3.1.1
/usr/lib/aarch64-linux-gnu/libgpiodcxx.so.2
Expected behavior
The behavior should be consistent across Pi 5 revisions.
Actual behavior
Works on Pi 5 rev 1.1.
Crashes on Pi 5 rev 1.0 with the stack trace below:
kiosk[3790]: /home/user/app/libgpiod.so.2: cannot open shared object file: No such file or directory
kiosk[3790]: /home/user/app/liblibgpiod.so.2: cannot open shared object file: No such file or directory
kiosk[3790]: /home/user/app/libgpiod.so.2.so: cannot open shared object file: No such file or directory
kiosk[3790]: /home/user/app/liblibgpiod.so.2.so: cannot open shared object file: No such file or directory
kiosk[3790]: at Interop.LibgpiodV1.gpiod_chip_iter_new()
kiosk[3790]: at Interop.LibgpiodV1.gpiod_chip_iter_new()
kiosk[3790]: at System.Device.Gpio.Drivers.LibGpiodDriver.GetAvailableChips()
kiosk[3790]: at System.Device.Gpio.GpioController.GetBestDriverForBoardOnLinux()
kiosk[3790]: at System.Device.Gpio.GpioController.GetBestDriverForBoard()
kiosk[3790]: at System.Device.Gpio.GpioController..ctor()
Versions used
Checked with Iot.Device.Bindings and System.Device.Gpio versions 4.0.1 and 4.2.0.
dotnet --info on our WSL build machine:
.NET SDK:
Version: 9.0.312
Commit: c45411d3fd
Workload version: 9.0.300-manifests.d333777a
MSBuild version: 17.14.43+2a0eb78b3
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/.../.dotnet/sdk/9.0.312/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.14
Architecture: x64
Commit: 19c07820cb
.NET SDKs installed:
9.0.312 [/home/.../.dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.14 [/home/.../.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.14 [/home/.../.dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
dotnet --info on the machine where app is being run (not applicable for self-contained apps):
Not applicable
Version of System.Device.Gpio package: present in 4.0.1 and 4.2.0
Firmware code 0xD04171 (Pi 5 rev 1.1) is not mapped in RaspberryBoardInfo.GetBoardModel() and thus the argument-less GpioController constructor which invokes GetBestDriverForBoardOnLinux() falls back to UnixDriver.Create()
iot/src/System.Device.Gpio/System/Device/Gpio/GpioController.cs
Line 481 in 9c867ff
On the other hand, firmware code 0xD04170 (Pi 5 rev 1.0) is mapped so GetBestDriverForBoardOnLinux() tries to invoke
iot/src/System.Device.Gpio/System/Device/Gpio/GpioController.cs
Line 469 in 9c867ff
Thus the same binary or image deployed on different Pi 5 revisions eventually behaves different ways.
Steps to reproduce
Invoke
on Pi 5 rev 1.0 and 1.1 separately on the same image.
We've used Raspberry Lite OS 64-bit image dated March 2026 which only contains these versions of libgpiod:
Expected behavior
The behavior should be consistent across Pi 5 revisions.
Actual behavior
Works on Pi 5 rev 1.1.
Crashes on Pi 5 rev 1.0 with the stack trace below:
Versions used
Checked with Iot.Device.Bindings and System.Device.Gpio versions 4.0.1 and 4.2.0.
dotnet --infoon our WSL build machine:dotnet --infoon the machine where app is being run (not applicable for self-contained apps):Not applicable
Version of
System.Device.Gpiopackage: present in 4.0.1 and 4.2.0