aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/pci.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-12-31 23:18:54 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2020-01-03 09:33:24 -0800
commit26033824194fbabd51547119e45e80cf40b433b6 (patch)
tree709c7d25217321bf483e57568917f0fcb7fb198e /modules/devices/pci.c
parent2d2290b346927851044ffcf5bbb63a0a0040d5a5 (diff)
pci: on second thought, only use class for missing device in list
The details will still show the specific device is unknown. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/pci.c')
-rw-r--r--modules/devices/pci.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/devices/pci.c b/modules/devices/pci.c
index aff51e2b..14f51a94 100644
--- a/modules/devices/pci.c
+++ b/modules/devices/pci.c
@@ -61,7 +61,7 @@ static const gchar *find_icon_for_class(uint32_t class)
static gchar *_pci_dev(const pcid *p, gchar *icons) {
gchar *str;
- const gchar *class, *vendor, *svendor, *product, *sproduct;
+ const gchar *class, *vendor, *svendor, *product, *sproduct, *lproduct;
gchar *name, *key;
gboolean device_is_sdevice = (p->vendor_id == p->sub_vendor_id && p->device_id == p->sub_device_id);
@@ -69,20 +69,21 @@ static gchar *_pci_dev(const pcid *p, gchar *icons) {
class = UNKIFNULL_AC(p->class_str);
vendor = UNKIFNULL_AC(p->vendor_id_str);
svendor = UNKIFNULL_AC(p->sub_vendor_id_str);
- product = p->device_id_str ? p->device_id_str : p->class_str;
- product = UNKIFNULL_AC(product);
+ product = UNKIFNULL_AC(p->device_id_str);
sproduct = UNKIFNULL_AC(p->sub_device_id_str);
+ lproduct = p->device_id_str ? p->device_id_str : p->class_str;
+ lproduct = UNKIFNULL_AC(lproduct);
gchar *ven_tag = vendor_match_tag(p->vendor_id_str, params.fmt_opts);
gchar *sven_tag = vendor_match_tag(p->sub_vendor_id_str, params.fmt_opts);
if (ven_tag) {
if (sven_tag && p->vendor_id != p->sub_vendor_id) {
- name = g_strdup_printf("%s %s %s", sven_tag, ven_tag, product);
+ name = g_strdup_printf("%s %s %s", sven_tag, ven_tag, lproduct);
} else {
- name = g_strdup_printf("%s %s", ven_tag, product);
+ name = g_strdup_printf("%s %s", ven_tag, lproduct);
}
} else {
- name = g_strdup_printf("%s %s", vendor, product);
+ name = g_strdup_printf("%s %s", vendor, lproduct);
}
g_free(ven_tag);
g_free(sven_tag);