Jinjinov / Hardware.Info

Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS.
MIT License
442 stars 76 forks source link

Second GPU not listed on Ubuntu 20.04 #67

Open NogginBops opened 3 weeks ago

NogginBops commented 3 weeks ago

Library version

100.1.0.0

OS, version, architecture (32 bit / 64 bit)

Ubuntu 20.04 x64

Describe the bug

On my machine with a dedicated nvidia graphics card and integrated AMD graphics the Nvidia card doesn't show up. This is because the code is looking for "VGA compatible controller" while the nvidia graphics card is reported as a "3D Controller". https://github.com/Jinjinov/Hardware.Info/blob/3e97cc04bce131c24b1e5a3910e9f5a51af7e746/Hardware.Info/Linux/HardwareInfoRetrieval.cs#L1164C66-L1164C91

See relevant part of my lspci:

...
01:00.0 3D controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] (rev a1)
02:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)
03:00.0 Network controller: MEDIATEK Corp. MT7921 802.11ax PCI Express Wireless Network Adapter
04:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c5)
...

To Reproduce

Steps to reproduce the behavior:

  1. Have a dual GPU system on Ubuntu 20.04.
  2. Run the following code:
    foreach (VideoController gpu in info.VideoControllerList)
    {
        Console.AppendLine("GPU Info:");
        Console.AppendLine($"Name: {gpu.Name}");
        Console.AppendLine($"Manufacturer: {gpu.Manufacturer}");
        Console.AppendLine($"Caption: {gpu.Caption}");
        Console.AppendLine($"Description: {gpu.Description}");
        Console.AppendLine($"Driver version: {gpu.DriverVersion}");
        Console.AppendLine($"Video processor: {gpu.VideoProcessor}");
        Console.AppendLine($"VRAM: {gpu.AdapterRAM}");
    }

Expected behavior

Both the AMD and Nvidia graphics cards should be listed.

Jinjinov commented 2 days ago

Thank you for noticing this!

This should be a simple fix.

Unfortunately I don't have a dedicated Linux PC, I am testing the code with VirtualBox and there the hardware representation is limited in many ways.

I will take a look at this as soon as I can. I will also try to test it on a dedicated Linux PC.

Jinjinov commented 2 days ago

Fixed in https://github.com/Jinjinov/Hardware.Info/releases/tag/v100.1.0.1

NogginBops commented 2 days ago

Fantastic! Will try the new version when I get back to working on my linux machine.