Skip to content

Commit eff2f8e

Browse files
committed
Include ChipInfo in QueryComponentInformation
1 parent 81eec32 commit eff2f8e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/System.Device.Gpio/System/Device/Gpio/Drivers/LibGpiodDriver.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ public override ComponentInformation QueryComponentInformation()
457457
IntPtr libgpiodVersionPtr = LibgpiodV1.gpiod_version_string();
458458
string libgpiodVersion = Marshal.PtrToStringAnsi(libgpiodVersionPtr) ?? string.Empty;
459459
self.Properties["LibGpiodVersion"] = libgpiodVersion;
460+
#pragma warning disable SDGPIO0001
461+
self.Properties["ChipInfo"] = GetChipInfo().ToString();
462+
#pragma warning restore SDGPIO0001
460463
return self;
461464
}
462465

src/System.Device.Gpio/System/Device/Gpio/Drivers/RaspberryPi3Driver.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ public override ComponentInformation QueryComponentInformation()
284284
{
285285
var ret = new ComponentInformation(this, "Generic Raspberry Pi Wrapper driver");
286286
ret.AddSubComponent(_internalDriver.QueryComponentInformation());
287+
#pragma warning disable SDGPIO0001
288+
ret.Properties["ChipInfo"] = _internalDriver.GetChipInfo().ToString();
289+
#pragma warning restore SDGPIO0001
287290
return ret;
288291
}
289292
}

src/System.Device.Gpio/System/Device/Gpio/Drivers/SysFsDriver.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Linq;
99
using System.Runtime.InteropServices;
1010
using System.Threading;
11+
using static Interop;
1112

1213
namespace System.Device.Gpio.Drivers;
1314

@@ -895,4 +896,14 @@ protected internal override PinMode GetPinMode(int pinNumber)
895896
throw new InvalidOperationException("There was an attempt to get a mode to a pin that is not open.");
896897
}
897898
}
899+
900+
/// <inheritdoc />
901+
public override ComponentInformation QueryComponentInformation()
902+
{
903+
var self = new ComponentInformation(this, "SysFsDriver");
904+
#pragma warning disable SDGPIO0001
905+
self.Properties["ChipInfo"] = GetChipInfo().ToString();
906+
#pragma warning restore SDGPIO0001
907+
return self;
908+
}
898909
}

0 commit comments

Comments
 (0)