diff options
author | Burt P <pburt0@gmail.com> | 2019-06-30 15:01:10 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-07-02 17:36:25 -0700 |
commit | d7750592038e79a602c329a42a813fa098e5f6ad (patch) | |
tree | 656cd331354d5882ed630306bc6b1ad677fb998b /modules/devices/dmi_memory.c | |
parent | 91ec3751545c81854e5c68c3edac2e33f175f3db (diff) |
Memory devices: try and get code bytes from DMI mfgr string
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/dmi_memory.c')
-rw-r--r-- | modules/devices/dmi_memory.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/devices/dmi_memory.c b/modules/devices/dmi_memory.c index ae016193..057a00b5 100644 --- a/modules/devices/dmi_memory.c +++ b/modules/devices/dmi_memory.c @@ -203,6 +203,7 @@ dmi_mem_socket *dmi_mem_socket_new(unsigned long h) { null_if_empty(&s->bank_locator); gchar *ah = dmidecode_match("Array Handle", &dtm, &h); + STR_IGNORE(ah, "Unknown"); if (ah) { s->array_handle = strtol(ah, NULL, 16); g_free(ah); @@ -281,6 +282,27 @@ dmi_mem_socket *dmi_mem_socket_new(unsigned long h) { } } + if (s->mfgr && !s->has_jedec_mfg_id && strlen(s->mfgr) == 4) { + /* Some BIOS put the code bytes into the mfgr string + * if they don't know the manufacturer. + * It's not always reliable, but what is lost + * by trying it? */ + if (isxdigit(s->mfgr[0]) + && isxdigit(s->mfgr[1]) + && isxdigit(s->mfgr[2]) + && isxdigit(s->mfgr[3]) ) { + int codes = strtol(s->mfgr, NULL, 16); + char *mstr = NULL; + decode_ddr34_manufacturer(codes >> 8, codes & 0xff, + &mstr, &s->mfgr_bank, &s->mfgr_index); + s->has_jedec_mfg_id = TRUE; + g_free(s->mfgr); + s->mfgr = NULL; + if (mstr) + s->mfgr = g_strdup(mstr); + } + } + s->vendor = vendor_match(s->mfgr, NULL); } return s; |