0a122b
From b907cc56cbbb6b979d97aa0c64eb08c1fe7b6f1e Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Mon, 3 Feb 2014 16:30:30 +0100
0a122b
Subject: [PATCH 06/28] usb: add support for microsoft os descriptors
0a122b
0a122b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Message-id: <1391445032-5540-4-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 57075
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 3/5] usb: add support for microsoft os descriptors
0a122b
Bugzilla: 1039530
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Juan Quintela <quintela@redhat.com>
0a122b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
0a122b
This patch adds support for special usb descriptors used by microsoft
0a122b
windows.  They allow more fine-grained control over driver binding and
0a122b
adding entries to the registry for configuration.
0a122b
0a122b
As this is a guest-visible change the "msos-desc" compat property
0a122b
has been added to turn this off for 1.7 + older
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
(cherry picked from commit 5319dc7b42610575cbd3a33f4340c1fb4f19b939)
0a122b
0a122b
Conflicts:
0a122b
	hw/i386/pc_piix.c        [ 1.7 compat properties ]
0a122b
	include/hw/i386/pc.h     [ likewise              ]
0a122b
---
0a122b
 hw/usb/Makefile.objs |   2 +-
0a122b
 hw/usb/bus.c         |   2 +
0a122b
 hw/usb/desc-msos.c   | 234 +++++++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 hw/usb/desc.c        |  37 +++++++-
0a122b
 hw/usb/desc.h        |  11 ++-
0a122b
 include/hw/usb.h     |   3 +
0a122b
 trace-events         |   1 +
0a122b
 7 files changed, 284 insertions(+), 6 deletions(-)
0a122b
 create mode 100644 hw/usb/desc-msos.c
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/usb/Makefile.objs |    2 +-
0a122b
 hw/usb/bus.c         |    2 +
0a122b
 hw/usb/desc-msos.c   |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 hw/usb/desc.c        |   37 +++++++-
0a122b
 hw/usb/desc.h        |   11 ++-
0a122b
 include/hw/usb.h     |    3 +
0a122b
 trace-events         |    1 +
0a122b
 7 files changed, 284 insertions(+), 6 deletions(-)
0a122b
 create mode 100644 hw/usb/desc-msos.c
0a122b
0a122b
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
0a122b
index a3eac3e..97b4575 100644
0a122b
--- a/hw/usb/Makefile.objs
0a122b
+++ b/hw/usb/Makefile.objs
0a122b
@@ -1,5 +1,5 @@
0a122b
 # usb subsystem core
0a122b
-common-obj-y += core.o combined-packet.o bus.o desc.o
0a122b
+common-obj-y += core.o combined-packet.o bus.o desc.o desc-msos.o
0a122b
 common-obj-y += libhw.o
0a122b
 
0a122b
 # usb host adapters
0a122b
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
0a122b
index ade9abc..fe6bd13 100644
0a122b
--- a/hw/usb/bus.c
0a122b
+++ b/hw/usb/bus.c
0a122b
@@ -16,6 +16,8 @@ static Property usb_props[] = {
0a122b
     DEFINE_PROP_STRING("serial", USBDevice, serial),
0a122b
     DEFINE_PROP_BIT("full-path", USBDevice, flags,
0a122b
                     USB_DEV_FLAG_FULL_PATH, true),
0a122b
+    DEFINE_PROP_BIT("msos-desc", USBDevice, flags,
0a122b
+                    USB_DEV_FLAG_MSOS_DESC_ENABLE, true),
0a122b
     DEFINE_PROP_END_OF_LIST()
0a122b
 };
0a122b
 
0a122b
diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c
0a122b
new file mode 100644
0a122b
index 0000000..ed8d62c
0a122b
--- /dev/null
0a122b
+++ b/hw/usb/desc-msos.c
0a122b
@@ -0,0 +1,234 @@
0a122b
+#include "hw/usb.h"
0a122b
+#include "hw/usb/desc.h"
0a122b
+
0a122b
+/*
0a122b
+ * Microsoft OS Descriptors
0a122b
+ *
0a122b
+ * Windows tries to fetch some special descriptors with informations
0a122b
+ * specifically for windows.  Presence is indicated using a special
0a122b
+ * string @ index 0xee.  There are two kinds of descriptors:
0a122b
+ *
0a122b
+ * compatid descriptor
0a122b
+ *   Used to bind drivers, if usb class isn't specific enougth.
0a122b
+ *   Used for PTP/MTP for example (both share the same usb class).
0a122b
+ *
0a122b
+ * properties descriptor
0a122b
+ *   Does carry registry entries.  They show up in
0a122b
+ *   HLM\SYSTEM\CurrentControlSet\Enum\USB\<devid>\<serial>\Device Parameters
0a122b
+ *
0a122b
+ * Note that Windows caches the stuff it got in the registry, so when
0a122b
+ * playing with this you have to delete registry subtrees to make
0a122b
+ * windows query the device again:
0a122b
+ *   HLM\SYSTEM\CurrentControlSet\Control\usbflags
0a122b
+ *   HLM\SYSTEM\CurrentControlSet\Enum\USB
0a122b
+ * Windows will complain it can't delete entries on the second one.
0a122b
+ * It has deleted everything it had permissions too, which is enouth
0a122b
+ * as this includes "Device Parameters".
0a122b
+ *
0a122b
+ * http://msdn.microsoft.com/en-us/library/windows/hardware/ff537430.aspx
0a122b
+ *
0a122b
+ */
0a122b
+
0a122b
+/* ------------------------------------------------------------------ */
0a122b
+
0a122b
+typedef struct msos_compat_hdr {
0a122b
+    uint32_t dwLength;
0a122b
+    uint8_t  bcdVersion_lo;
0a122b
+    uint8_t  bcdVersion_hi;
0a122b
+    uint8_t  wIndex_lo;
0a122b
+    uint8_t  wIndex_hi;
0a122b
+    uint8_t  bCount;
0a122b
+    uint8_t  reserved[7];
0a122b
+} QEMU_PACKED msos_compat_hdr;
0a122b
+
0a122b
+typedef struct msos_compat_func {
0a122b
+    uint8_t  bFirstInterfaceNumber;
0a122b
+    uint8_t  reserved_1;
0a122b
+    uint8_t  compatibleId[8];
0a122b
+    uint8_t  subCompatibleId[8];
0a122b
+    uint8_t  reserved_2[6];
0a122b
+} QEMU_PACKED msos_compat_func;
0a122b
+
0a122b
+static int usb_desc_msos_compat(const USBDesc *desc, uint8_t *dest)
0a122b
+{
0a122b
+    msos_compat_hdr *hdr = (void *)dest;
0a122b
+    msos_compat_func *func;
0a122b
+    int length = sizeof(*hdr);
0a122b
+    int count = 0;
0a122b
+
0a122b
+    func = (void *)(dest + length);
0a122b
+    func->bFirstInterfaceNumber = 0;
0a122b
+    func->reserved_1 = 0x01;
0a122b
+    length += sizeof(*func);
0a122b
+    count++;
0a122b
+
0a122b
+    hdr->dwLength      = cpu_to_le32(length);
0a122b
+    hdr->bcdVersion_lo = 0x00;
0a122b
+    hdr->bcdVersion_hi = 0x01;
0a122b
+    hdr->wIndex_lo     = 0x04;
0a122b
+    hdr->wIndex_hi     = 0x00;
0a122b
+    hdr->bCount        = count;
0a122b
+    return length;
0a122b
+}
0a122b
+
0a122b
+/* ------------------------------------------------------------------ */
0a122b
+
0a122b
+typedef struct msos_prop_hdr {
0a122b
+    uint32_t dwLength;
0a122b
+    uint8_t  bcdVersion_lo;
0a122b
+    uint8_t  bcdVersion_hi;
0a122b
+    uint8_t  wIndex_lo;
0a122b
+    uint8_t  wIndex_hi;
0a122b
+    uint8_t  wCount_lo;
0a122b
+    uint8_t  wCount_hi;
0a122b
+} QEMU_PACKED msos_prop_hdr;
0a122b
+
0a122b
+typedef struct msos_prop {
0a122b
+    uint32_t dwLength;
0a122b
+    uint32_t dwPropertyDataType;
0a122b
+    uint8_t  dwPropertyNameLength_lo;
0a122b
+    uint8_t  dwPropertyNameLength_hi;
0a122b
+    uint8_t  bPropertyName[];
0a122b
+} QEMU_PACKED msos_prop;
0a122b
+
0a122b
+typedef struct msos_prop_data {
0a122b
+    uint32_t dwPropertyDataLength;
0a122b
+    uint8_t  bPropertyData[];
0a122b
+} QEMU_PACKED msos_prop_data;
0a122b
+
0a122b
+typedef enum msos_prop_type {
0a122b
+    MSOS_REG_SZ        = 1,
0a122b
+    MSOS_REG_EXPAND_SZ = 2,
0a122b
+    MSOS_REG_BINARY    = 3,
0a122b
+    MSOS_REG_DWORD_LE  = 4,
0a122b
+    MSOS_REG_DWORD_BE  = 5,
0a122b
+    MSOS_REG_LINK      = 6,
0a122b
+    MSOS_REG_MULTI_SZ  = 7,
0a122b
+} msos_prop_type;
0a122b
+
0a122b
+static int usb_desc_msos_prop_name(struct msos_prop *prop,
0a122b
+                                   const wchar_t *name)
0a122b
+{
0a122b
+    int length = wcslen(name) + 1;
0a122b
+    int i;
0a122b
+
0a122b
+    prop->dwPropertyNameLength_lo = usb_lo(length*2);
0a122b
+    prop->dwPropertyNameLength_hi = usb_hi(length*2);
0a122b
+    for (i = 0; i < length; i++) {
0a122b
+        prop->bPropertyName[i*2]   = usb_lo(name[i]);
0a122b
+        prop->bPropertyName[i*2+1] = usb_hi(name[i]);
0a122b
+    }
0a122b
+    return length*2;
0a122b
+}
0a122b
+
0a122b
+static int usb_desc_msos_prop_str(uint8_t *dest, msos_prop_type type,
0a122b
+                                  const wchar_t *name, const wchar_t *value)
0a122b
+{
0a122b
+    struct msos_prop *prop = (void *)dest;
0a122b
+    struct msos_prop_data *data;
0a122b
+    int length = sizeof(*prop);
0a122b
+    int i, vlen = wcslen(value) + 1;
0a122b
+
0a122b
+    prop->dwPropertyDataType = cpu_to_le32(type);
0a122b
+    length += usb_desc_msos_prop_name(prop, name);
0a122b
+    data = (void *)(dest + length);
0a122b
+
0a122b
+    data->dwPropertyDataLength = cpu_to_le32(vlen*2);
0a122b
+    length += sizeof(*prop);
0a122b
+
0a122b
+    for (i = 0; i < vlen; i++) {
0a122b
+        data->bPropertyData[i*2]   = usb_lo(value[i]);
0a122b
+        data->bPropertyData[i*2+1] = usb_hi(value[i]);
0a122b
+    }
0a122b
+    length += vlen*2;
0a122b
+
0a122b
+    prop->dwLength = cpu_to_le32(length);
0a122b
+    return length;
0a122b
+}
0a122b
+
0a122b
+static int usb_desc_msos_prop_dword(uint8_t *dest, const wchar_t *name,
0a122b
+                                    uint32_t value)
0a122b
+{
0a122b
+    struct msos_prop *prop = (void *)dest;
0a122b
+    struct msos_prop_data *data;
0a122b
+    int length = sizeof(*prop);
0a122b
+
0a122b
+    prop->dwPropertyDataType = cpu_to_le32(MSOS_REG_DWORD_LE);
0a122b
+    length += usb_desc_msos_prop_name(prop, name);
0a122b
+    data = (void *)(dest + length);
0a122b
+
0a122b
+    data->dwPropertyDataLength = cpu_to_le32(4);
0a122b
+    data->bPropertyData[0] = (value)       & 0xff;
0a122b
+    data->bPropertyData[1] = (value >>  8) & 0xff;
0a122b
+    data->bPropertyData[2] = (value >> 16) & 0xff;
0a122b
+    data->bPropertyData[3] = (value >> 24) & 0xff;
0a122b
+    length += sizeof(*prop) + 4;
0a122b
+
0a122b
+    prop->dwLength = cpu_to_le32(length);
0a122b
+    return length;
0a122b
+}
0a122b
+
0a122b
+static int usb_desc_msos_prop(const USBDesc *desc, uint8_t *dest)
0a122b
+{
0a122b
+    msos_prop_hdr *hdr = (void *)dest;
0a122b
+    int length = sizeof(*hdr);
0a122b
+    int count = 0;
0a122b
+
0a122b
+    if (desc->msos->Label) {
0a122b
+        /*
0a122b
+         * Given as example in the specs.  Havn't figured yet where
0a122b
+         * this label shows up in the windows gui.
0a122b
+         */
0a122b
+        length += usb_desc_msos_prop_str(dest+length, MSOS_REG_SZ,
0a122b
+                                         L"Label", desc->msos->Label);
0a122b
+        count++;
0a122b
+    }
0a122b
+
0a122b
+    if (desc->msos->SelectiveSuspendEnabled) {
0a122b
+        /*
0a122b
+         * Signaling remote wakeup capability in the standard usb
0a122b
+         * descriptors isn't enouth to make windows actually use it.
0a122b
+         * This is the "Yes, we really mean it" registy entry to flip
0a122b
+         * the switch in the windows drivers.
0a122b
+         */
0a122b
+        length += usb_desc_msos_prop_dword(dest+length,
0a122b
+                                           L"SelectiveSuspendEnabled", 1);
0a122b
+        count++;
0a122b
+    }
0a122b
+
0a122b
+    hdr->dwLength      = cpu_to_le32(length);
0a122b
+    hdr->bcdVersion_lo = 0x00;
0a122b
+    hdr->bcdVersion_hi = 0x01;
0a122b
+    hdr->wIndex_lo     = 0x05;
0a122b
+    hdr->wIndex_hi     = 0x00;
0a122b
+    hdr->wCount_lo     = usb_lo(count);
0a122b
+    hdr->wCount_hi     = usb_hi(count);
0a122b
+    return length;
0a122b
+}
0a122b
+
0a122b
+/* ------------------------------------------------------------------ */
0a122b
+
0a122b
+int usb_desc_msos(const USBDesc *desc,  USBPacket *p,
0a122b
+                  int index, uint8_t *dest, size_t len)
0a122b
+{
0a122b
+    void *buf = g_malloc0(4096);
0a122b
+    int length = 0;
0a122b
+
0a122b
+    switch (index) {
0a122b
+    case 0x0004:
0a122b
+        length = usb_desc_msos_compat(desc, buf);
0a122b
+        break;
0a122b
+    case 0x0005:
0a122b
+        length = usb_desc_msos_prop(desc, buf);
0a122b
+        break;
0a122b
+    }
0a122b
+
0a122b
+    if (length > len) {
0a122b
+        length = len;
0a122b
+    }
0a122b
+    memcpy(dest, buf, length);
0a122b
+    free(buf);
0a122b
+
0a122b
+    p->actual_length = length;
0a122b
+    return 0;
0a122b
+}
0a122b
diff --git a/hw/usb/desc.c b/hw/usb/desc.c
0a122b
index 3e560cd..5a954c6 100644
0a122b
--- a/hw/usb/desc.c
0a122b
+++ b/hw/usb/desc.c
0a122b
@@ -7,7 +7,7 @@
0a122b
 /* ------------------------------------------------------------------ */
0a122b
 
0a122b
 int usb_desc_device(const USBDescID *id, const USBDescDevice *dev,
0a122b
-                    uint8_t *dest, size_t len)
0a122b
+                    bool msos, uint8_t *dest, size_t len)
0a122b
 {
0a122b
     uint8_t bLength = 0x12;
0a122b
     USBDescriptor *d = (void *)dest;
0a122b
@@ -19,8 +19,18 @@ int usb_desc_device(const USBDescID *id, const USBDescDevice *dev,
0a122b
     d->bLength                     = bLength;
0a122b
     d->bDescriptorType             = USB_DT_DEVICE;
0a122b
 
0a122b
-    d->u.device.bcdUSB_lo          = usb_lo(dev->bcdUSB);
0a122b
-    d->u.device.bcdUSB_hi          = usb_hi(dev->bcdUSB);
0a122b
+    if (msos && dev->bcdUSB < 0x0200) {
0a122b
+        /*
0a122b
+         * Version 2.0+ required for microsoft os descriptors to work.
0a122b
+         * Done this way so msos-desc compat property will handle both
0a122b
+         * the version and the new descriptors being present.
0a122b
+         */
0a122b
+        d->u.device.bcdUSB_lo          = usb_lo(0x0200);
0a122b
+        d->u.device.bcdUSB_hi          = usb_hi(0x0200);
0a122b
+    } else {
0a122b
+        d->u.device.bcdUSB_lo          = usb_lo(dev->bcdUSB);
0a122b
+        d->u.device.bcdUSB_hi          = usb_hi(dev->bcdUSB);
0a122b
+    }
0a122b
     d->u.device.bDeviceClass       = dev->bDeviceClass;
0a122b
     d->u.device.bDeviceSubClass    = dev->bDeviceSubClass;
0a122b
     d->u.device.bDeviceProtocol    = dev->bDeviceProtocol;
0a122b
@@ -497,6 +507,10 @@ void usb_desc_init(USBDevice *dev)
0a122b
     if (desc->super) {
0a122b
         dev->speedmask |= USB_SPEED_MASK_SUPER;
0a122b
     }
0a122b
+    if (desc->msos && (dev->flags & (1 << USB_DEV_FLAG_MSOS_DESC_ENABLE))) {
0a122b
+        dev->flags |= (1 << USB_DEV_FLAG_MSOS_DESC_IN_USE);
0a122b
+        usb_desc_set_string(dev, 0xee, "MSFT100Q");
0a122b
+    }
0a122b
     usb_desc_setdefaults(dev);
0a122b
 }
0a122b
 
0a122b
@@ -624,6 +638,7 @@ int usb_desc_string(USBDevice *dev, int index, uint8_t *dest, size_t len)
0a122b
 int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,
0a122b
                             int value, uint8_t *dest, size_t len)
0a122b
 {
0a122b
+    bool msos = (dev->flags & (1 << USB_DEV_FLAG_MSOS_DESC_IN_USE));
0a122b
     const USBDesc *desc = usb_device_get_usb_desc(dev);
0a122b
     const USBDescDevice *other_dev;
0a122b
     uint8_t buf[256];
0a122b
@@ -644,7 +659,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,
0a122b
 
0a122b
     switch(type) {
0a122b
     case USB_DT_DEVICE:
0a122b
-        ret = usb_desc_device(&desc->id, dev->device, buf, sizeof(buf));
0a122b
+        ret = usb_desc_device(&desc->id, dev->device, msos, buf, sizeof(buf));
0a122b
         trace_usb_desc_device(dev->addr, len, ret);
0a122b
         break;
0a122b
     case USB_DT_CONFIG:
0a122b
@@ -701,6 +716,7 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p,
0a122b
 int usb_desc_handle_control(USBDevice *dev, USBPacket *p,
0a122b
         int request, int value, int index, int length, uint8_t *data)
0a122b
 {
0a122b
+    bool msos = (dev->flags & (1 << USB_DEV_FLAG_MSOS_DESC_IN_USE));
0a122b
     const USBDesc *desc = usb_device_get_usb_desc(dev);
0a122b
     int ret = -1;
0a122b
 
0a122b
@@ -780,6 +796,19 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p,
0a122b
         trace_usb_set_interface(dev->addr, index, value, ret);
0a122b
         break;
0a122b
 
0a122b
+    case VendorDeviceRequest | 'Q':
0a122b
+        if (msos) {
0a122b
+            ret = usb_desc_msos(desc, p, index, data, length);
0a122b
+            trace_usb_desc_msos(dev->addr, index, length, ret);
0a122b
+        }
0a122b
+        break;
0a122b
+    case VendorInterfaceRequest | 'Q':
0a122b
+        if (msos) {
0a122b
+            ret = usb_desc_msos(desc, p, index, data, length);
0a122b
+            trace_usb_desc_msos(dev->addr, index, length, ret);
0a122b
+        }
0a122b
+        break;
0a122b
+
0a122b
     }
0a122b
     return ret;
0a122b
 }
0a122b
diff --git a/hw/usb/desc.h b/hw/usb/desc.h
0a122b
index 81327b0..2b4fcda 100644
0a122b
--- a/hw/usb/desc.h
0a122b
+++ b/hw/usb/desc.h
0a122b
@@ -2,6 +2,7 @@
0a122b
 #define QEMU_HW_USB_DESC_H
0a122b
 
0a122b
 #include <inttypes.h>
0a122b
+#include <wchar.h>
0a122b
 
0a122b
 /* binary representation */
0a122b
 typedef struct USBDescriptor {
0a122b
@@ -182,6 +183,11 @@ struct USBDescOther {
0a122b
     const uint8_t             *data;
0a122b
 };
0a122b
 
0a122b
+struct USBDescMSOS {
0a122b
+    const wchar_t             *Label;
0a122b
+    bool                      SelectiveSuspendEnabled;
0a122b
+};
0a122b
+
0a122b
 typedef const char *USBDescStrings[256];
0a122b
 
0a122b
 struct USBDesc {
0a122b
@@ -190,6 +196,7 @@ struct USBDesc {
0a122b
     const USBDescDevice       *high;
0a122b
     const USBDescDevice       *super;
0a122b
     const char* const         *str;
0a122b
+    const USBDescMSOS         *msos;
0a122b
 };
0a122b
 
0a122b
 #define USB_DESC_FLAG_SUPER (1 << 1)
0a122b
@@ -207,7 +214,7 @@ static inline uint8_t usb_hi(uint16_t val)
0a122b
 
0a122b
 /* generate usb packages from structs */
0a122b
 int usb_desc_device(const USBDescID *id, const USBDescDevice *dev,
0a122b
-                    uint8_t *dest, size_t len);
0a122b
+                    bool msos, uint8_t *dest, size_t len);
0a122b
 int usb_desc_device_qualifier(const USBDescDevice *dev,
0a122b
                               uint8_t *dest, size_t len);
0a122b
 int usb_desc_config(const USBDescConfig *conf, int flags,
0a122b
@@ -219,6 +226,8 @@ int usb_desc_iface(const USBDescIface *iface, int flags,
0a122b
 int usb_desc_endpoint(const USBDescEndpoint *ep, int flags,
0a122b
                       uint8_t *dest, size_t len);
0a122b
 int usb_desc_other(const USBDescOther *desc, uint8_t *dest, size_t len);
0a122b
+int usb_desc_msos(const USBDesc *desc, USBPacket *p,
0a122b
+                  int index, uint8_t *dest, size_t len);
0a122b
 
0a122b
 /* control message emulation helpers */
0a122b
 void usb_desc_init(USBDevice *dev);
0a122b
diff --git a/include/hw/usb.h b/include/hw/usb.h
0a122b
index a910456..b111be0 100644
0a122b
--- a/include/hw/usb.h
0a122b
+++ b/include/hw/usb.h
0a122b
@@ -182,6 +182,7 @@ typedef struct USBDescIface USBDescIface;
0a122b
 typedef struct USBDescEndpoint USBDescEndpoint;
0a122b
 typedef struct USBDescOther USBDescOther;
0a122b
 typedef struct USBDescString USBDescString;
0a122b
+typedef struct USBDescMSOS USBDescMSOS;
0a122b
 
0a122b
 struct USBDescString {
0a122b
     uint8_t index;
0a122b
@@ -207,6 +208,8 @@ struct USBEndpoint {
0a122b
 enum USBDeviceFlags {
0a122b
     USB_DEV_FLAG_FULL_PATH,
0a122b
     USB_DEV_FLAG_IS_HOST,
0a122b
+    USB_DEV_FLAG_MSOS_DESC_ENABLE,
0a122b
+    USB_DEV_FLAG_MSOS_DESC_IN_USE,
0a122b
 };
0a122b
 
0a122b
 /* definition of a USB device */
0a122b
diff --git a/trace-events b/trace-events
0a122b
index dbbd25d..5d86cf3 100644
0a122b
--- a/trace-events
0a122b
+++ b/trace-events
0a122b
@@ -393,6 +393,7 @@ usb_desc_config(int addr, int index, int len, int ret) "dev %d query config %d,
0a122b
 usb_desc_other_speed_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
0a122b
 usb_desc_string(int addr, int index, int len, int ret) "dev %d query string %d, len %d, ret %d"
0a122b
 usb_desc_bos(int addr, int len, int ret) "dev %d bos, len %d, ret %d"
0a122b
+usb_desc_msos(int addr, int index, int len, int ret) "dev %d msos, index 0x%x, len %d, ret %d"
0a122b
 usb_set_addr(int addr) "dev %d"
0a122b
 usb_set_config(int addr, int config, int ret) "dev %d, config %d, ret %d"
0a122b
 usb_set_interface(int addr, int iface, int alt, int ret) "dev %d, interface %d, altsetting %d, ret %d"
0a122b
-- 
0a122b
1.7.1
0a122b