|
26 | 26 |
|
27 | 27 | #include "config.h"
|
28 | 28 | #include "types.h"
|
| 29 | +#include "dmidecode.h" |
29 | 30 | #include "dmiopt.h"
|
30 | 31 |
|
31 | 32 |
|
@@ -146,30 +147,36 @@ struct string_keyword
|
146 | 147 | const char *keyword;
|
147 | 148 | u8 type;
|
148 | 149 | u8 offset;
|
| 150 | + const char *(*lookup)(u8); |
| 151 | + void (*print)(u8 *); |
149 | 152 | };
|
150 | 153 |
|
151 | 154 | /* This lookup table could admittedly be reworked for improved performance.
|
152 | 155 | Due to the low count of items in there at the moment, it did not seem
|
153 | 156 | worth the additional code complexity though. */
|
154 | 157 | static const struct string_keyword opt_string_keyword[]={
|
155 |
| - { "bios-vendor", 0, 0x04 }, |
156 |
| - { "bios-version", 0, 0x05 }, |
157 |
| - { "bios-release-date", 0, 0x08 }, |
158 |
| - { "system-manufacturer", 1, 0x04 }, |
159 |
| - { "system-product-name", 1, 0x05 }, |
160 |
| - { "system-version", 1, 0x06 }, |
161 |
| - { "system-serial-number", 1, 0x07 }, |
162 |
| - { "baseboard-manufacturer", 2, 0x04 }, |
163 |
| - { "baseboard-product-name", 2, 0x05 }, |
164 |
| - { "baseboard-version", 2, 0x06 }, |
165 |
| - { "baseboard-serial-number", 2, 0x07 }, |
166 |
| - { "baseboard-asset-tag", 2, 0x08 }, |
167 |
| - { "chassis-manufacturer", 3, 0x04 }, |
168 |
| - { "chassis-version", 3, 0x06 }, |
169 |
| - { "chassis-serial-number", 3, 0x07 }, |
170 |
| - { "chassis-asset-tag", 3, 0x08 }, |
171 |
| - { "processor-manufacturer", 4, 0x07 }, |
172 |
| - { "processor-version", 4, 0x10 }, |
| 158 | + { "bios-vendor", 0, 0x04, NULL, NULL }, |
| 159 | + { "bios-version", 0, 0x05, NULL, NULL }, |
| 160 | + { "bios-release-date", 0, 0x08, NULL, NULL }, |
| 161 | + { "system-manufacturer", 1, 0x04, NULL, NULL }, |
| 162 | + { "system-product-name", 1, 0x05, NULL, NULL }, |
| 163 | + { "system-version", 1, 0x06, NULL, NULL }, |
| 164 | + { "system-serial-number", 1, 0x07, NULL, NULL }, |
| 165 | + { "system-uuid", 1, 0x08, NULL, dmi_system_uuid }, |
| 166 | + { "baseboard-manufacturer", 2, 0x04, NULL, NULL }, |
| 167 | + { "baseboard-product-name", 2, 0x05, NULL, NULL }, |
| 168 | + { "baseboard-version", 2, 0x06, NULL, NULL }, |
| 169 | + { "baseboard-serial-number", 2, 0x07, NULL, NULL }, |
| 170 | + { "baseboard-asset-tag", 2, 0x08, NULL, NULL }, |
| 171 | + { "chassis-manufacturer", 3, 0x04, NULL, NULL }, |
| 172 | + { "chassis-type", 3, 0x05, dmi_chassis_type, NULL }, |
| 173 | + { "chassis-version", 3, 0x06, NULL, NULL }, |
| 174 | + { "chassis-serial-number", 3, 0x07, NULL, NULL }, |
| 175 | + { "chassis-asset-tag", 3, 0x08, NULL, NULL }, |
| 176 | + { "processor-family", 4, 0x06, dmi_processor_family, NULL }, |
| 177 | + { "processor-manufacturer", 4, 0x07, NULL, NULL }, |
| 178 | + { "processor-version", 4, 0x10, NULL, NULL }, |
| 179 | + { "processor-frequency", 4, 0x16, NULL, dmi_processor_frequency }, |
173 | 180 | };
|
174 | 181 |
|
175 | 182 | static void print_opt_string_list(void)
|
@@ -199,6 +206,8 @@ static int parse_opt_string(const char *arg)
|
199 | 206 | {
|
200 | 207 | opt.string_type=opt_string_keyword[i].type;
|
201 | 208 | opt.string_offset=opt_string_keyword[i].offset;
|
| 209 | + opt.string_lookup=opt_string_keyword[i].lookup; |
| 210 | + opt.string_print=opt_string_keyword[i].print; |
202 | 211 | return 0;
|
203 | 212 | }
|
204 | 213 | }
|
|
0 commit comments