USB描述符代码
const u8 HID_DeviceDescriptor[HID_SIZ_DEVICE_DESC] =
{
18, // bLength //É豸ÃèÊö·ûµÄ×Ö½ÚÊý´óС
0x01, // bDescriptorType //É豸ÃèÊö·ûÀàÐͱàºÅ
0x00, // bcdUSB //USB°æ±¾ºÅ
0x02,
0x00, // bDeviceClass //USB·ÖÅäµÄÉ豸Àà´úÂë
0x00, // bDeviceSubClass //USB·ÖÅäµÄ×ÓÀà´úÂë
0x00, // bDeviceProtocol//USB·ÖÅäµÄÉ豸ÐÒé´úÂë
0x40, // bMaxPacketSize0 //¶Ëµã0µÄ×î´ó°ü´óС
0x6c, // idVendor//³§É̱àºÅ£¬×Ô¼º¸ÄÒ»¸ö
0x50,
0x08, // idProduct//²úÆ·±àºÅ£¬×Ô¼º¸ÄÒ»¸ö
0x89,
0x0001, // bcdDevice//É豸³ö³§±àºÅ
0x01, // iManufacturer //É豸³§ÉÌ×Ö·û´®µÄË÷Òý
0x02, // iProduct//ÃèÊö²úÆ·×Ö·û´®µÄË÷Òý
0x03, // iSerialNumber //ÃèÊöÉ豸ÐòÁкÅ×Ö·û´®µÄË÷Òý
0x01 // bNumConfigurations//¿ÉÄܵÄÅäÖÃÊýÁ¿
}
; /* HID_DeviceDescriptor */
/* USB Configuration Descriptor */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const u8 HID_ConfigDescriptor[HID_SIZ_CONFIG_DESC] =
{
0x09, /* ÅäÖÃÃèÊö·û³¤¶È */
0x02, /* ÃèÊö·ûÀàÐÍ(0x02:ÅäÖÃÃèÊö·û) */
34, /* ×ܵÄÃèÊö·û³¤¶È£¬ÊµÖÊÊÇ×îºó7¸ö×Ö½ÚÊÇûÓÃµÄ */
0x00,
0x01, /* ½Ó¿ÚÊýÄ¿ */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing the configuration*/
0x80, /* bmAttributes: Bus powered (Bus powered: 7th bit, Self Powered: 6th bit, Remote wakeup: 5th bit, reserved: 4..0 bits )*/
0x32, /* ×î´óʹÓõçÁ÷´óС(2mAΪµ¥Î») */
/************** ½Ó¿ÚÃèÊö·û****************/
0x09, /* ½Ó¿ÚÃèÊö·û³¤¶È */
0x04, /* ÃèÊö·ûÀàÐÍ(0x04:½Ó¿ÚÃèÊö·û) */
0x00, /* ½Ó¿ÚºÅ(´Ó0¿ªÊ¼) */
0x00, /* ¿ÉÑ¡ÉèÖõÄË÷ÒýÖµ */
0x01, /* ʹÓö˵ãÊýÄ¿(0±íʾֻÊÇÓö˵ã0) */
0x03, /* ½Ó¿ÚÀà(0x03:HIDÀà) */
0x01, /* ×Ó½Ó¿ÚÀà : 1 = BOOT, 0 = NO BOOT */
0x01, /* ½Ó¿ÚÐÒé : 0 = ÎÞ, 1 = ¼üÅÌ, 2 = Êó±ê */
0x00, /* ÃèÊö½Ó¿ÚµÄ×Ö·û´®Ë÷Òý(0±íʾ²»Ê¹ÓÃ) */
/******************** HIDÃèÊö·û ********************/
0x09, /* HIDÃèÊö·û´óС */
0x21, /* ÃèÊö·ûÀàÐÍ(0x21: 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 */
95+2, /* ±¨¸æÃèÊö·û×ܳ¤¶È */
0x00,
/******************** ¶Ëµã2ÃèÊö·û ******************/
0x07, /* ÃèÊö·û³¤¶È */
0x05, /* ÃèÊö·ûÀàÐÍ(0x05:¶Ëµã) */
0x81, /* Ö¸Ã÷¶ËµãºÅºÍ·½Ïò(0~3λΪ¶ËµãºÅ,µÚ7λ= 1ΪIN¶Ëµã,µÚ7λ= 0ΪOUT¶Ëµã£¬ÆäËûλ±£Áô)*/
0x03, /* ¶ËµãÀàÐÍ(0x00->¿ØÖÆ,0x01->ͬ²½,0x02->ÅúÁ¿,0x03->ÖжÏ) */
0x08, /* ·¢ËÍ»òÕß½ÓÊÕµÄ×î´ó°ü´óС-8¸ö×Ö½Ú */
0x00,
0x0a, /* Öж϶˵ãÖ÷»ú²éѯ¼ä¸ô(µ¥Î»Îª1ms)£¬Í¬²½¶Ëµã´Ë×Ö½ÚΪ0x01,ÅúÁ¿¡¢¿ØÖƶ˵㲻ʹÓôË×Ö½Ú */
/******************** ¶Ëµã1ÃèÊö·û ******************/
0x07, /* ÃèÊö·û³¤¶È */
0x05, /* ÃèÊö·ûÀàÐÍ(0x05:¶Ëµã) */
0x01, /* Ö¸Ã÷¶ËµãºÅºÍ·½Ïò(0~3λΪ¶ËµãºÅ,µÚ7λ= 1ΪIN¶Ëµã,µÚ7λ= 0ΪOUT¶Ëµã£¬ÆäËûλ±£Áô) */
0x03, /* ¶ËµãÀàÐÍ(0x00->¿ØÖÆ,0x01->ͬ²½,0x02->ÅúÁ¿,0x03->ÖжÏ) */
0x40, /* ·¢ËÍ»òÕß½ÓÊÕµÄ×î´ó°ü´óС */
0x00,
0xff, /* Öж϶˵ãÖ÷»ú²éѯ¼ä¸ô(µ¥Î»Îª1ms)£¬Í¬²½¶Ëµã´Ë×Ö½ÚΪ0x01,ÅúÁ¿¡¢¿ØÖƶ˵㲻ʹÓôË×Ö½Ú */
}
; /* MOUSE_ConfigDescriptor */
|