summaryrefslogtreecommitdiff
path: root/dmiopt.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2005-09-14 19:44:28 +0000
committerJean Delvare <jdelvare@suse.de>2005-09-14 19:44:28 +0000
commit02b421ee8cddcff5f233970b68c644a7d352cb98 (patch)
tree4d36657942920547973d100e037dd64a971ad839 /dmiopt.c
parent1a7eb2fd7578a5120d6bf2ded45a534df8240cbb (diff)
downloaddmidecode-git-02b421ee8cddcff5f233970b68c644a7d352cb98.tar.gz
Make it possible for --string to print decoded binary data rather than
only DMI strings. Add four such string keywords.
Diffstat (limited to 'dmiopt.c')
-rw-r--r--dmiopt.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/dmiopt.c b/dmiopt.c
index 401315e..d61241d 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "types.h"
+#include "dmidecode.h"
#include "dmiopt.h"
@@ -146,30 +147,36 @@ struct string_keyword
const char *keyword;
u8 type;
u8 offset;
+ const char *(*lookup)(u8);
+ void (*print)(u8 *);
};
/* This lookup table could admittedly be reworked for improved performance.
Due to the low count of items in there at the moment, it did not seem
worth the additional code complexity though. */
static const struct string_keyword opt_string_keyword[]={
- { "bios-vendor", 0, 0x04 },
- { "bios-version", 0, 0x05 },
- { "bios-release-date", 0, 0x08 },
- { "system-manufacturer", 1, 0x04 },
- { "system-product-name", 1, 0x05 },
- { "system-version", 1, 0x06 },
- { "system-serial-number", 1, 0x07 },
- { "baseboard-manufacturer", 2, 0x04 },
- { "baseboard-product-name", 2, 0x05 },
- { "baseboard-version", 2, 0x06 },
- { "baseboard-serial-number", 2, 0x07 },
- { "baseboard-asset-tag", 2, 0x08 },
- { "chassis-manufacturer", 3, 0x04 },
- { "chassis-version", 3, 0x06 },
- { "chassis-serial-number", 3, 0x07 },
- { "chassis-asset-tag", 3, 0x08 },
- { "processor-manufacturer", 4, 0x07 },
- { "processor-version", 4, 0x10 },
+ { "bios-vendor", 0, 0x04, NULL, NULL },
+ { "bios-version", 0, 0x05, NULL, NULL },
+ { "bios-release-date", 0, 0x08, NULL, NULL },
+ { "system-manufacturer", 1, 0x04, NULL, NULL },
+ { "system-product-name", 1, 0x05, NULL, NULL },
+ { "system-version", 1, 0x06, NULL, NULL },
+ { "system-serial-number", 1, 0x07, NULL, NULL },
+ { "system-uuid", 1, 0x08, NULL, dmi_system_uuid },
+ { "baseboard-manufacturer", 2, 0x04, NULL, NULL },
+ { "baseboard-product-name", 2, 0x05, NULL, NULL },
+ { "baseboard-version", 2, 0x06, NULL, NULL },
+ { "baseboard-serial-number", 2, 0x07, NULL, NULL },
+ { "baseboard-asset-tag", 2, 0x08, NULL, NULL },
+ { "chassis-manufacturer", 3, 0x04, NULL, NULL },
+ { "chassis-type", 3, 0x05, dmi_chassis_type, NULL },
+ { "chassis-version", 3, 0x06, NULL, NULL },
+ { "chassis-serial-number", 3, 0x07, NULL, NULL },
+ { "chassis-asset-tag", 3, 0x08, NULL, NULL },
+ { "processor-family", 4, 0x06, dmi_processor_family, NULL },
+ { "processor-manufacturer", 4, 0x07, NULL, NULL },
+ { "processor-version", 4, 0x10, NULL, NULL },
+ { "processor-frequency", 4, 0x16, NULL, dmi_processor_frequency },
};
static void print_opt_string_list(void)
@@ -199,6 +206,8 @@ static int parse_opt_string(const char *arg)
{
opt.string_type=opt_string_keyword[i].type;
opt.string_offset=opt_string_keyword[i].offset;
+ opt.string_lookup=opt_string_keyword[i].lookup;
+ opt.string_print=opt_string_keyword[i].print;
return 0;
}
}