dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dmidecode] [PATCH 2/4] dmidecode: Some OEM records require Product Name


From: Jerry Hoemann
Subject: [dmidecode] [PATCH 2/4] dmidecode: Some OEM records require Product Name
Date: Thu, 19 Nov 2020 12:55:14 -0700

Decoding of OEM records can depend upon the product in addition
to the manufacturer.  So, save "Product Name" from type 1 record
in addition to "Manufacturer" in dmi_set_vendor.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 dmidecode.c | 4 ++--
 dmioem.c    | 5 ++++-
 dmioem.h    | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dmidecode.c b/dmidecode.c
index 404c7e1..ac96395 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5242,8 +5242,8 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, 
u16 ver, u32 flags)
                }
 
                /* assign vendor for vendor-specific decodes later */
-               if (h.type == 1 && h.length >= 5)
-                       dmi_set_vendor(dmi_string(&h, data[0x04]));
+               if (h.type == 1 && h.length >= 6)
+                       dmi_set_vendor(dmi_string(&h, data[0x04]), 
dmi_string(&h, data[0x5]));
 
                /* Fixup a common mistake */
                if (h.type == 34)
diff --git a/dmioem.c b/dmioem.c
index beb3df0..36820e4 100644
--- a/dmioem.c
+++ b/dmioem.c
@@ -42,13 +42,14 @@ enum DMI_VENDORS
 };
 
 static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN;
+static const char *dmi_product = NULL;
 
 /*
  * Remember the system vendor for later use. We only actually store the
  * value if we know how to decode at least one specific entry type for
  * that vendor.
  */
-void dmi_set_vendor(const char *s)
+void dmi_set_vendor(const char *s, const char *p)
 {
        int len;
 
@@ -70,6 +71,8 @@ void dmi_set_vendor(const char *s)
                dmi_vendor = VENDOR_IBM;
        else if (strncmp(s, "LENOVO", len) == 0)
                dmi_vendor = VENDOR_LENOVO;
+
+       dmi_product = p;
 }
 
 /*
diff --git a/dmioem.h b/dmioem.h
index 3916766..b79b769 100644
--- a/dmioem.h
+++ b/dmioem.h
@@ -21,5 +21,5 @@
 
 struct dmi_header;
 
-void dmi_set_vendor(const char *s);
+void dmi_set_vendor(const char *s, const char *p);
 int dmi_decode_oem(const struct dmi_header *h);
-- 
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]