Merge pull request #1594 from geomtech/impl-get-device

Add GetDevice function with bus, slot, function informations
This commit is contained in:
valentinbreiz 2020-12-15 01:02:23 +01:00 committed by GitHub
commit 6ae8a0d65a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,6 +164,27 @@ namespace Cosmos.HAL
return null;
}
/// <summary>
/// Get device.
/// </summary>
/// <param name="bus">Bus ID.</param>
/// <param name="slot">Slot position ID.</param>
/// <param name="function">Function ID.</param>
/// <returns></returns>
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)