1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

Remove unused short IDs

This also replaces the meaningless numbers in the DMI debug printout
with the parameter names.

Corresponding to flashrom svn r912.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Michael Karcher 2010-02-24 22:43:44 +00:00
parent 844863933d
commit f6498d7a44

23
dmi.c
View File

@ -36,16 +36,13 @@ enum dmi_strings {
/* The short_id for baseboard starts with "m" as in mainboard to leave /* The short_id for baseboard starts with "m" as in mainboard to leave
"b" available for BIOS */ "b" available for BIOS */
struct { const char *dmidecode_names[DMI_ID_INVALID] = {
const char *dmidecode_name; "system-manufacturer",
char short_id[3]; "system-product-name",
} dmi_properties[DMI_ID_INVALID] = { "system-version",
{"system-manufacturer", "sm"}, "baseboard-manufacturer",
{"system-product-name", "sp"}, "baseboard-product-name",
{"system-version", "sv"}, "baseboard-version"
{"baseboard-manufacturer", "mm"},
{"baseboard-product-name", "mp"},
{"baseboard-version", "mv"}
}; };
#define DMI_COMMAND_LEN_MAX 260 #define DMI_COMMAND_LEN_MAX 260
@ -71,8 +68,7 @@ void dmi_init(void)
{ {
char commandline[DMI_COMMAND_LEN_MAX+40]; char commandline[DMI_COMMAND_LEN_MAX+40];
snprintf(commandline, sizeof(commandline), snprintf(commandline, sizeof(commandline),
"%s -s %s", dmidecode_command, "%s -s %s", dmidecode_command, dmidecode_names[i]);
dmi_properties[i].dmidecode_name);
dmidecode_pipe = popen(commandline, "r"); dmidecode_pipe = popen(commandline, "r");
if (!dmidecode_pipe) if (!dmidecode_pipe)
{ {
@ -100,7 +96,8 @@ void dmi_init(void)
if (answerbuf[0] != 0 && if (answerbuf[0] != 0 &&
answerbuf[strlen(answerbuf) - 1] == '\n') answerbuf[strlen(answerbuf) - 1] == '\n')
answerbuf[strlen(answerbuf) - 1] = 0; answerbuf[strlen(answerbuf) - 1] = 0;
printf_debug("DMI string %d: \"%s\"\n", i, answerbuf); printf_debug("DMI string %s: \"%s\"\n", dmidecode_names[i],
answerbuf);
dmistrings[i] = strdup(answerbuf); dmistrings[i] = strdup(answerbuf);
} }
has_dmi_support = 1; has_dmi_support = 1;