.bNumConfigurations = 1,
};
+static struct usb_otg_descriptor otg_descriptor = {
+ .bLength = sizeof otg_descriptor,
+ .bDescriptorType = USB_DT_OTG,
+ .bcdOTG = 0x0200, /* version 2.0 */
+};
+
+const struct usb_descriptor_header *otg_desc[] = {
+ (struct usb_descriptor_header *) &otg_descriptor,
+ NULL,
+};
+
static struct usb_configuration android_config_driver = {
.label = "android",
.unbind = android_unbind_config,
struct android_dev *dev = _android_dev;
int ret = 0;
+ if (gadget_is_otg(c->cdev->gadget))
+ c->descriptors = otg_desc;
+
ret = android_bind_enabled_functions(dev, c);
if (ret)
return ret;
device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
}
+ if (gadget_is_otg(gadget))
+ cdev->otg_desc = &otg_descriptor;
+
usb_gadget_set_selfpowered(gadget);
dev->cdev = cdev;
/*-------------------------------------------------------------------------*/
-/* USB_DT_OTG (from OTG 1.0a supplement) */
+/* USB_DT_OTG (from OTG 2.0) */
struct usb_otg_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bmAttributes; /* support for HNP, SRP, etc */
+ __le16 bcdOTG; /* release number, i.e, 2.0 is 0x0200 */
} __attribute__ ((packed));
/* from usb_otg_descriptor.bmAttributes */
#define USB_OTG_SRP (1 << 0)
#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
+#define USB_OTG_ADP (1 << 2) /* attachment detection */
/*-------------------------------------------------------------------------*/