diff options
author | Burt P <pburt0@gmail.com> | 2018-06-03 11:29:13 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-06-03 15:49:57 -0700 |
commit | 876904323e12786a65ac14fc2c67e22fe587fa96 (patch) | |
tree | 207306d612978622c28773d750d6d8269ae985c3 | |
parent | 41b2c29a6c516ea6027c7ca6b14351d51cdf7643 (diff) |
gpu_util: use vendor_match() in make_nice_name()
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r-- | data/vendor.ids | 13 | ||||
-rw-r--r-- | hardinfo/gpu_util.c | 18 |
2 files changed, 25 insertions, 6 deletions
diff --git a/data/vendor.ids b/data/vendor.ids index 736547c1..b59d07ce 100644 --- a/data/vendor.ids +++ b/data/vendor.ids @@ -3,7 +3,9 @@ # # Syntax: # name <name> +# name_short <shorter name> # url <url> +# url_support <url> # [match_string|match_string_case] <match> # ... # [match_string|match_string_case] <match> @@ -20,18 +22,24 @@ name ASUS match_string ASUSTek match_string ASUS +# PCI Vendor 1022 name Advanced Micro Devices + name_short AMD url www.amd.com match_string Advanced Micro Devices match_string_case AMD +# PCI Vendor 1002 name Advanced Micro Devices (formerly ATI) + name_short AMD/ATI url www.amd.com match_string ATI Technologies + match_string Advanced Micro Devices, Inc. [AMD/ATI] match_string_case AMD/ATI match_string_case ATI -name nVidia +name nVidia Corporation + name_short nVidia url www.nvidia.com match_string nVidia @@ -39,7 +47,8 @@ name 3Com url www.3com.com match_string 3Com -name Intel +name Intel Corporation + name_short Intel url www.intel.com match_string Intel diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c index 1fa3de46..dd1845a0 100644 --- a/hardinfo/gpu_util.c +++ b/hardinfo/gpu_util.c @@ -149,15 +149,25 @@ static void make_nice_name(gpud *s) { if (!device_str) device_str = unk_d; - if (strstr(vendor_str, "NVIDIA")) { + /* try and a get a "short name" for the vendor */ + const Vendor *v = vendor_match(vendor_str, NULL); + if (v && v->name_short) + vendor_str = v->name_short; + + /* These two former special cases are currently handled by the vendor_match() + * function well enough, but the notes are preserved here. */ /* nvidia PCI strings are pretty nice already, * just shorten the company name */ - s->nice_name = g_strdup_printf("%s %s", "NVIDIA", device_str); - } else if (strstr(vendor_str, "AMD/ATI")) { + // s->nice_name = g_strdup_printf("%s %s", "nVidia", device_str); + /* Intel Graphics may have very long names, like "Intel Corporation Seventh Generation Something Core Something Something Integrated Graphics Processor Revision Ninety-four" + * but for now at least shorten "Intel Corporation" to just "Intel" */ + // s->nice_name = g_strdup_printf("%s %s", "Intel", device_str); + + if (strstr(vendor_str, "AMD")) { /* AMD PCI strings are crazy stupid because they use the exact same * chip and device id for a zillion "different products" */ char *full_name = strdup(device_str); - /* Try and shorten it to the chip code name only */ + /* Try and shorten it to the chip code name only, at least */ char *b = strchr(full_name, '['); if (b) *b = '\0'; s->nice_name = g_strdup_printf("%s %s", "AMD/ATI", g_strstrip(full_name)); |