补上几个描述符
const uint8_t USB_DeviceDescriptor[18] =
{
0x12, /* bLength: Size of this descriptor in bytes */
0x01, /* bDescriptorType: DEVICE Descriptor Type */
0x00, /* bcdUSB: version 2.00=0200, 1.10=0110 */
0x02,
0x00, /* bDeviceClass: each interface define the device class */
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0: Maximum packet size for endpoint zero */
0x83, /* idVendor: (0483) Vendor ID (assigned by the USB-IF) */
0x04,
0x20, /* idProduct: Product ID (assigned by the manufacturer) */
0x57,
0x00, /* bcdDevice: 2.00 Device release number in binary-coded decimal */
0x02,
0x01, /* iManufacturer: Index of string descriptor describing manufacturer */
0x02, /* iProduct: Index of string descriptor describing product */
0x03, /* iSerialNumber: Index of string descriptor describing the device's serial number */
0x01 /* bNumConfigurations: Number of possible configurations */
};
const uint8_t USB_ConfigDescriptor[41] =
{
0x09, /* bLength: Size of this descriptor in bytes */
0x02, /* bDescriptorType: CONFIGURATION Descriptor Type */
0x29, /* wTotalLength: Total length of data returned for this configuration. */
0x00,
0x01, /* bNumInterfaces: Number of interfaces supported by this configuration */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing this configuration */
0xE0, /* bmAttributes: self powered */
0x32, /* MaxPower: 100 mA, 0x01 represent 1mA */
/******************** Descriptor of interface ********************/
/* 09 */
0x09, /* bLength: Size of this descriptor in bytes */
0x04, /* bDescriptorType: Interface*/
0x00, /* bInterfaceNumber: Index of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x03, /* bNumEndpoints: Number of endpoint */
0x03, /* bInterfaceClass: HID Class */
0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0x04, /* iInterface: Index of string descriptor describing this interface*/
/******************** Descriptor of HID ********************/
/* 18 */
0x09, /* bLength: HID Descriptor size */
0x21, /* bDescriptorType: HID */
0x10, /* bcdHID: HID Class Spec release number */
0x01,
0x00, /* bCountryCode: Hardware target country */
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
0x22, /* bDescriptorType */
0x30, /* wItemLength: Total length of Report descriptor */
0x00,
/* [bDescriptorType] */
/* [wItemLength] */