Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question on UUIDs...
2013-02-25, 09:23
Post: #8
RE: Question on UUIDs...
I had the same issue recently, on HP DL120 G7. Didn't had it on Dell PE R200 nor any IBM's. Anyway what I did was to tweak the uuid a bit:
It now works as it should. I also added a touppercase conversion since i've seen that some BIOSes return it lower case and some uppercase.
I'm not sure what impact this has on other machines though due to endianess. I hope i'll have the time to look at how dmidecode reads it.

I hope it helps.

Code:
diff --git a/src/core/uuid.c b/src/core/uuid.c
index 27a249d..d4deda3 100644
--- a/src/core/uuid.c
+++ b/src/core/uuid.c
@@ -21,7 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );

#include <stdint.h>
#include <stdio.h>
-#include <byteswap.h>
+#include <ctype.h>
#include <ipxe/uuid.h>

/** @file
@@ -39,13 +39,18 @@ FILE_LICENCE ( GPL2_OR_LATER );
char * uuid_ntoa ( const union uuid *uuid ) {
        static char buf[37]; /* "00000000-0000-0000-0000-000000000000" */

-       sprintf ( buf, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
-                 be32_to_cpu ( uuid->canonical.a ),
-                 be16_to_cpu ( uuid->canonical.b ),
-                 be16_to_cpu ( uuid->canonical.c ),
-                 be16_to_cpu ( uuid->canonical.d ),
+       sprintf ( buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                 uuid->canonical.a[3], uuid->canonical.a[2],
+                 uuid->canonical.a[1], uuid->canonical.a[0],
+                 uuid->canonical.b[1], uuid->canonical.b[0],
+                 uuid->canonical.c[1], uuid->canonical.c[0],
+                 uuid->canonical.d[1], uuid->canonical.d[0],
                  uuid->canonical.e[0], uuid->canonical.e[1],
                  uuid->canonical.e[2], uuid->canonical.e[3],
                  uuid->canonical.e[4], uuid->canonical.e[5] );
+       int i=0;
+       do
+           buf[i]=toupper(buf[i]);
+       while (buf[i++]);
        return buf;
}
diff --git a/src/include/ipxe/uuid.h b/src/include/ipxe/uuid.h
index 5de56b9..88a0a15 100644
--- a/src/include/ipxe/uuid.h
+++ b/src/include/ipxe/uuid.h
@@ -15,13 +15,13 @@ union uuid {
        /** Canonical form (00000000-0000-0000-0000-000000000000) */
        struct {
                /** 8 hex digits, big-endian */
-               uint32_t a;
+               uint8_t a[4];
                /** 2 hex digits, big-endian */
-               uint16_t b;
+               uint8_t b[2];
                /** 2 hex digits, big-endian */
-               uint16_t c;
+               uint8_t c[2];
                /** 2 hex digits, big-endian */
-               uint16_t d;
+               uint8_t d[2];
                /** 12 hex digits, big-endian */
                uint8_t e[6];
        } canonical;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Question on UUIDs... - MultimediaMan - 2012-10-27, 21:15
RE: Question on UUIDs... - Alexandru Bordei - 2013-02-25 09:23
RE: Question on UUIDs... - mcb30 - 2013-03-20, 01:37



User(s) browsing this thread: 2 Guest(s)