Skip to content

Commit 3acd66b

Browse files
committed
Print system uuid in all 3 formats
references acidanthera/bugtracker#1457
1 parent a2b6def commit 3acd66b

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

dmidecode.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -472,32 +472,37 @@ static void dmi_system_uuid(void (*print_cb)(const char *name, const char *forma
472472
* The specification says that this is the defacto standard,
473473
* however I've seen systems following RFC 4122 instead and use
474474
* network byte order, so I am reluctant to apply the byte-swapping
475-
* for older versions.
475+
* for older versions. Print in all three possible formats.
476476
*/
477-
if (ver >= 0x0206)
478-
{
479-
if (print_cb)
480-
print_cb(attr,
481-
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
482-
p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
483-
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
484-
else
485-
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
486-
p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
487-
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
488-
}
477+
if (print_cb)
478+
print_cb(attr,
479+
"{%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x} (RAW)",
480+
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
481+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
489482
else
490-
{
491-
if (print_cb)
492-
print_cb(attr,
493-
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
494-
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
495-
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
496-
else
497-
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
498-
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
499-
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
500-
}
483+
printf("{%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x} (RAW)\n",
484+
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
485+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
486+
487+
if (print_cb)
488+
print_cb(attr,
489+
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x (SMBIOS 2.6+%s)",
490+
p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
491+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], ver >= 0x0206 ? ", preferred" : "");
492+
else
493+
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x (SMBIOS 2.6+%s)\n",
494+
p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
495+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], ver >= 0x0206 ? ", preferred" : "");
496+
497+
if (print_cb)
498+
print_cb(attr,
499+
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x (RFC 4122, Apple)",
500+
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
501+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
502+
else
503+
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x (RFC 4122, Apple)\n",
504+
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
505+
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
501506
}
502507

503508
static const char *dmi_system_wake_up_type(u8 code)

0 commit comments

Comments
 (0)