Skip to content

Commit a1321e8

Browse files
committed
Add driver_name property to GPU classes with a new get_string_property in PCI vapi
1 parent 799c8e6 commit a1321e8

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

src/Resources/GPU/GPUAmd.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class Monitor.GPUAmd : IGPU, Object {
99

1010
public string hwmon_module_name { get; set; }
1111

12+
public string driver_name { get; set; }
13+
1214
public string name { get; set; }
1315

1416
public int percentage { get; protected set; }
@@ -28,6 +30,7 @@ public class Monitor.GPUAmd : IGPU, Object {
2830
name = "AMD® " + name;
2931

3032
sysfs_path = pci_parse_sysfs_path (pci_access, pci_device);
33+
driver_name = pci_device.get_string_property (Pci.FILL_DRIVER);
3134
}
3235

3336
private void update_temperature () {

src/Resources/GPU/GPUIntel.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class Monitor.GPUIntel : IGPU, Object {
99

1010
public string hwmon_module_name { get; set; }
1111

12+
public string driver_name { get; set; }
13+
1214
public string name { get; set; }
1315

1416
public int percentage { get; protected set; }
@@ -28,6 +30,8 @@ public class Monitor.GPUIntel : IGPU, Object {
2830
name = "Intel® " + name;
2931

3032
sysfs_path = pci_parse_sysfs_path (pci_access, pci_device);
33+
driver_name = pci_device.get_string_property (Pci.FILL_DRIVER);
34+
3135
}
3236

3337
private void update_temperature () {

src/Resources/GPU/GPUNvidia.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class Monitor.GPUNvidia : IGPU, Object {
99

1010
public string hwmon_module_name { get; set; }
1111

12+
public string driver_name { get; set; }
13+
1214
public string name { get; set; }
1315

1416
public int percentage { get; protected set; }
@@ -54,6 +56,7 @@ public class Monitor.GPUNvidia : IGPU, Object {
5456
name = "nVidia® " + name;
5557

5658
sysfs_path = pci_parse_sysfs_path (pci_access, pci_device);
59+
driver_name = pci_device.get_string_property (Pci.FILL_DRIVER);
5760
}
5861

5962
construct {

src/Resources/GPU/IGPU.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public interface Monitor.IGPU : Object {
99

1010
public abstract string hwmon_module_name { get; protected set; }
1111

12+
public abstract string driver_name { get; protected set; }
13+
1214
public abstract string name { get; protected set; }
1315

1416
public abstract int percentage { get; protected set; }

src/Resources/Resources.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class Monitor.Resources : Object {
5454
char namebuf[1024];
5555

5656
for (unowned Pci.Dev pci_device = pci_access.devices; pci_device != null; pci_device = pci_device.next) {
57-
pci_device.fill_info (Pci.FILL_IDENT | Pci.FILL_BASES | Pci.FILL_CLASS_EXT | Pci.FILL_LABEL | Pci.FILL_CLASS);
57+
pci_device.fill_info (Pci.FILL_IDENT | Pci.FILL_BASES | Pci.FILL_CLASS_EXT | Pci.FILL_LABEL | Pci.FILL_CLASS | Pci.FILL_DRIVER);
5858
string name = pci_access.lookup_name (namebuf, Pci.LookupMode.DEVICE, pci_device.vendor_id, pci_device.device_id);
5959

6060
// Looking for a specific PCI device class

vapi/pci.vapi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ namespace Pci {
165165
[CCode (cname = "pci_fill_info")]
166166
public int fill_info (int flags);
167167

168+
[CCode (cname = "pci_get_string_property")]
169+
public unowned string ? get_string_property (int flag);
170+
168171
private Dev ();
169172
}
170173

0 commit comments

Comments
 (0)