|
|
|
|
@ -20,6 +20,71 @@
|
|
|
|
|
|
|
|
|
|
#include "u_os_desc.h"
|
|
|
|
|
|
|
|
|
|
//#if defined (CONFIG_GAOYANG)
|
|
|
|
|
// (struct usb_descriptor_header *) &WINUSB_WCIDDescriptor,
|
|
|
|
|
//#endif // defined (CONFIG_GAOYANG)
|
|
|
|
|
#if defined (CONFIG_GAOYANG)
|
|
|
|
|
#define WINUSB_IF0_WCID_PROPERTIES_SIZE (142)
|
|
|
|
|
|
|
|
|
|
const uint8_t WINUSB_IF0_WCIDProperties [142] = {
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
/// WCID property descriptor
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
0x8e, 0x00, 0x00, 0x00, /* dwLength */
|
|
|
|
|
0x00, 0x01, /* bcdVersion */
|
|
|
|
|
0x05, 0x00, /* wIndex */
|
|
|
|
|
0x01, 0x00, /* wCount */
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
/// registry propter descriptor
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
0x84, 0x00, 0x00, 0x00, /* dwSize */
|
|
|
|
|
0x01, 0x00, 0x00, 0x00, /* dwPropertyDataType */
|
|
|
|
|
0x28, 0x00, /* wPropertyNameLength */
|
|
|
|
|
/* DeviceInterfaceGUID */
|
|
|
|
|
'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, /* wcName_20 */
|
|
|
|
|
'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, /* wcName_20 */
|
|
|
|
|
't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, /* wcName_20 */
|
|
|
|
|
'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, /* wcName_20 */
|
|
|
|
|
'U', 0x00, 'I', 0x00, 'D', 0x00, 0x00, 0x00, /* wcName_20 */
|
|
|
|
|
0x4e, 0x00, 0x00, 0x00, /* dwPropertyDataLength */
|
|
|
|
|
/* {1D4B2365-4749-48EA-B38A-7C6FDDDD7E26} */
|
|
|
|
|
'{', 0x00, '1', 0x00, 'D', 0x00, '4', 0x00, /* wcData_39 */
|
|
|
|
|
'B', 0x00, '2', 0x00, '3', 0x00, '6', 0x00, /* wcData_39 */
|
|
|
|
|
'5', 0x00, '-', 0x00, '4', 0x00, '7', 0x00, /* wcData_39 */
|
|
|
|
|
'4', 0x00, '9', 0x00, '-', 0x00, '4', 0x00, /* wcData_39 */
|
|
|
|
|
'8', 0x00, 'E', 0x00, 'A', 0x00, '-', 0x00, /* wcData_39 */
|
|
|
|
|
'B', 0x00, '3', 0x00, '8', 0x00, 'A', 0x00, /* wcData_39 */
|
|
|
|
|
'-', 0x00, '7', 0x00, 'C', 0x00, '6', 0x00, /* wcData_39 */
|
|
|
|
|
'F', 0x00, 'D', 0x00, 'D', 0x00, 'D', 0x00, /* wcData_39 */
|
|
|
|
|
'D', 0x00, '7', 0x00, 'E', 0x00, '2', 0x00, /* wcData_39 */
|
|
|
|
|
'6', 0x00, '}', 0x00, 0x00, 0x00, /* wcData_39 */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define WINUSB_WCID_DESCRIPTOR_SIZE (40)
|
|
|
|
|
const uint8_t WINUSB_WCIDDescriptor [40] = {
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
/// WCID descriptor
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
0x28, 0x00, 0x00, 0x00, /* dwLength */
|
|
|
|
|
0x00, 0x01, /* bcdVersion */
|
|
|
|
|
0x04, 0x00, /* wIndex */
|
|
|
|
|
0x01, /* bCount */
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* bReserved_7 */
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
/// WCID function descriptor
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
|
0x00, /* bFirstInterfaceNumber */
|
|
|
|
|
0x01, /* bReserved */
|
|
|
|
|
/* WINUSB */
|
|
|
|
|
'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00, /* cCID_8 */
|
|
|
|
|
/* */
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* cSubCID_8 */
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* bReserved_6 */
|
|
|
|
|
};
|
|
|
|
|
#endif // defined (CONFIG_GAOYANG)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* struct usb_os_string - represents OS String to be reported by a gadget
|
|
|
|
|
* @bLength: total length of the entire descritor, always 0x12
|
|
|
|
|
@ -664,6 +729,35 @@ static int bos_desc(struct usb_composite_dev *cdev)
|
|
|
|
|
struct usb_ext_cap_descriptor *usb_ext;
|
|
|
|
|
struct usb_dcd_config_params dcd_config_params;
|
|
|
|
|
struct usb_bos_descriptor *bos = cdev->req->buf;
|
|
|
|
|
#if defined (CONFIG_GAOYANG)
|
|
|
|
|
/* WCID20 device capability descriptor */
|
|
|
|
|
#define USB_CAP_TYPE_WCID 5
|
|
|
|
|
#define USB_CAP_WCID_SIZE 0x1C
|
|
|
|
|
#define WINUSB20_WCID_VENDOR_CODE 0x00
|
|
|
|
|
#define WINUSB20_WCID_DESC_SET_SIZE 162
|
|
|
|
|
|
|
|
|
|
struct usb_cap_wcid20_descriptor {
|
|
|
|
|
__u8 bLength;
|
|
|
|
|
__u8 bDescriptorType;
|
|
|
|
|
__u8 bDevCapabilityType;
|
|
|
|
|
__u8 bReserved ;
|
|
|
|
|
__u8 bPlatformCapabilityUUID_16[16];
|
|
|
|
|
__u32 dwWindowsVersion;
|
|
|
|
|
__le32 wDescriptorSetTotalLength;
|
|
|
|
|
__u8 bVendorCode;
|
|
|
|
|
__u8 bAltEnumCode;
|
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
|
|
char winusb20_wcidbos_uuid[] = {
|
|
|
|
|
0xdf, 0x60, 0xdd, 0xd8, 0x89, 0x45, 0xc7, 0x4c,
|
|
|
|
|
0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, 0x9f,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uint32_t winusb20_wcidbos_version = 0x06030000;
|
|
|
|
|
|
|
|
|
|
struct usb_cap_wcid20_descriptor *usb_cap_wcid;
|
|
|
|
|
|
|
|
|
|
#endif // defined (CONFIG_GAOYANG)
|
|
|
|
|
unsigned int besl = 0;
|
|
|
|
|
|
|
|
|
|
bos->bLength = USB_DT_BOS_SIZE;
|
|
|
|
|
@ -694,7 +788,6 @@ static int bos_desc(struct usb_composite_dev *cdev)
|
|
|
|
|
if (dcd_config_params.besl_deep != USB_DEFAULT_BESL_UNSPECIFIED)
|
|
|
|
|
besl |= USB_BESL_DEEP_VALID |
|
|
|
|
|
USB_SET_BESL_DEEP(dcd_config_params.besl_deep);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A SuperSpeed device shall include the USB2.0 extension descriptor
|
|
|
|
|
* and shall support LPM when operating in USB2.0 HS mode.
|
|
|
|
|
@ -708,6 +801,19 @@ static int bos_desc(struct usb_composite_dev *cdev)
|
|
|
|
|
usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT |
|
|
|
|
|
USB_BESL_SUPPORT | besl);
|
|
|
|
|
|
|
|
|
|
#if defined (CONFIG_GAOYANG)
|
|
|
|
|
usb_cap_wcid = cdev->req->buf + le16_to_cpu(bos->wTotalLength);
|
|
|
|
|
le16_add_cpu(&bos->wTotalLength, USB_CAP_WCID_SIZE);
|
|
|
|
|
bos->bNumDeviceCaps++;
|
|
|
|
|
|
|
|
|
|
usb_cap_wcid->bLength = USB_CAP_WCID_SIZE;
|
|
|
|
|
usb_cap_wcid->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
|
|
|
|
|
usb_cap_wcid->bDevCapabilityType = USB_CAP_TYPE_WCID;
|
|
|
|
|
usb_cap_wcid->dwWindowsVersion = winusb20_wcidbos_version;
|
|
|
|
|
usb_cap_wcid->wDescriptorSetTotalLength = cpu_to_le32(WINUSB20_WCID_DESC_SET_SIZE);
|
|
|
|
|
usb_cap_wcid->bVendorCode = WINUSB20_WCID_VENDOR_CODE;
|
|
|
|
|
memcpy(usb_cap_wcid->bPlatformCapabilityUUID_16, winusb20_wcidbos_uuid, sizeof(winusb20_wcidbos_uuid));
|
|
|
|
|
#endif // defined (CONFIG_GAOYANG)
|
|
|
|
|
/*
|
|
|
|
|
* The Superspeed USB Capability descriptor shall be implemented by all
|
|
|
|
|
* SuperSpeed devices.
|
|
|
|
|
|