From 705b5d9d03c1aad27dcd4e9af0a86619d0cac19e Mon Sep 17 00:00:00 2001 From: "Alexy DA CRUZ (GeomTech)" Date: Mon, 14 Dec 2020 22:59:42 +0100 Subject: [PATCH] Add GetDevice with bus, slot, function informations. --- source/Cosmos.HAL2/PCI.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/Cosmos.HAL2/PCI.cs b/source/Cosmos.HAL2/PCI.cs index cab4ffee3..1123ec50a 100644 --- a/source/Cosmos.HAL2/PCI.cs +++ b/source/Cosmos.HAL2/PCI.cs @@ -164,6 +164,27 @@ namespace Cosmos.HAL return null; } + /// + /// Get device. + /// + /// Bus ID. + /// Slot position ID. + /// Function ID. + /// + public static PCIDevice GetDevice(uint bus, uint slot, uint function) + { + foreach (var xDevice in Devices) + { + if (xDevice.bus == bus && + xDevice.slot == slot && + xDevice.function == function) + { + return xDevice; + } + } + return null; + } + public static PCIDevice GetDeviceClass(ClassID Class, SubclassID SubClass) { foreach (var xDevice in Devices)