Diff between 0e9fcdce8b852d94e35f0d583db154a58add569c and fc41a5af76e825dcf2ef4f1de4a807c4a33ab5b2

Changed Files

File Additions Deletions Status
monitor/uuid.c +22 -0 modified
monitor/uuid.h +2 -0 modified

Full Patch

diff --git a/monitor/uuid.c b/monitor/uuid.c
index c348e17..9ab3ce2 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -26,6 +26,9 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
+#include <string.h>
+
 #include "uuid.h"
 
 static struct {
@@ -159,3 +162,22 @@ const char *uuid32_to_str(uint32_t uuid)
 
 	return "Unknown";
 }
+
+const char *uuidstr_to_str(const char *uuid)
+{
+	uint32_t val;
+
+	if (!uuid)
+		return NULL;
+
+	if (strlen(uuid) != 36)
+		return NULL;
+
+	if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
+		return "Vendor specific";
+
+	if (sscanf(uuid, "%08x-0000-1000-8000-00805f9b34fb", &val) != 1)
+		return NULL;
+
+	return uuid32_to_str(val);
+}
diff --git a/monitor/uuid.h b/monitor/uuid.h
index f118cb3..4d441c8 100644
--- a/monitor/uuid.h
+++ b/monitor/uuid.h
@@ -26,3 +26,5 @@
 
 const char *uuid16_to_str(uint16_t uuid);
 const char *uuid32_to_str(uint32_t uuid);
+
+const char *uuidstr_to_str(const char *uuid);