Permalink
Browse files

Bugfix GUID printing

  • Loading branch information...
1 parent 9745afc commit ba1b0d304304a509671f347be35b3f8072496279 David Brownell committed Dec 10, 2006
Showing with 19 additions and 4 deletions.
  1. +4 −0 ChangeLog
  2. +15 −4 lsusb.c
View
@@ -1,3 +1,7 @@
+2006-12-10 David Brownell <dbrownell@users.sourceforge.net>
+ * lsusb.c: bugfix GUID printing; byteorder matches rfc 4122
+ * usb.ids: update to current version
+
2006-05-03 David Brownell <dbrownell@users.sourceforge.net>
* lsusb.c: handle another cdc descriptor type; endianness fix
for config descriptor length and endpoint maxpacket
View
19 lsusb.c
@@ -242,10 +242,21 @@ static int get_videoterminal_string(char *buf, size_t size, u_int16_t termt)
static const char *get_guid(unsigned char *buf)
{
static char guid[39];
- sprintf(guid, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- buf[3], buf[2], buf[1], buf[0], buf[5], buf[4], buf[7], buf[6],
- buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14],
- buf[15]);
+
+ /* NOTE: see RFC 4122 for more information about GUID/UUID
+ * structure. The first fields fields are historically big
+ * endian numbers, dating from Apollo mc68000 workstations.
+ */
+ sprintf(guid, "{%02x%02x%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x%02x%02x%02x%02x}",
+ buf[0], buf[1], buf[2], buf[3],
+ buf[4], buf[5],
+ buf[6], buf[7],
+ buf[8], buf[9],
+ buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
return guid;
}

0 comments on commit ba1b0d3

Please sign in to comment.