/******************************************************************************** * Copyright (c) 2016, Beijing Tongfang Microelectroics Co., Ltd. * All rights reserved. * Module: HID descripter and global parameter * Author: Yang Song * Version: V1.0 * History: * 2016-09-22 Original version ********************************************************************************/ #include "global.h" const u8 usbHidPosInterfaceDescriptor[] = { 0x09,0x04,0x00,0x00,0x02,0x03,0x00,0x00,0x00,//以前字符串索引为0x07,导致苹果和部分安卓,读取失败,产生兼容性问题,不支持的字符串,都写00就好。 }; const u8 usbHidKbdInterfaceDescriptor[] = { 0x09,0x04,0x00,0x00,0x01,0x03,0x01,0x01,0x00,//字符串没有,就不要写0x07了,会导致枚举不成功。凡是没有的字符串,一律写0. }; const u8 usbHidPosDeviceClassDescriptor[] = { 0x09,0x21,0x10,0x01,0x00,0x01,0x22,HID_POS_RPT_LEN,0x00, }; const u8 usbHidKbdDeviceClassDescriptor[] = { 0x09,0x21,0x10,0x01,0x00,0x01,0x22,HID_KBD_RPT_LEN,0x00, }; const u8 usbHidPosEndpointDescriptor[] = { 14, 0x07,0x05,0x82,0x03,HIDINTPKTSIZE,0x00,0x04, 0x07,0x05,0x01,0x03,HIDINTPKTSIZE,0x00,0x04, }; const u8 usbHidKbdEndpointDescriptor[] = { 6, 0x07,0x05,0x82,0x03,HIDINTPKTSIZE,0x00,//IN ep //0x07,0x05,0x01,0x03,HIDINTPKTSIZE,0x00,0x02, }; //==================================================== //报告描述符(input report/output report) //const u8 hidReportDescriptor[HID_RPT_LEN] = //{ // 0x05, 0x01, // Usage Page (vendor defined FFA0) (Global) // 0x09, 0x06, // Usage (vendor defined) (Local) // 0xa1, 0x01, // Collection (Application) (Main) // 0x05, 0x07, // Usage Page (vendor defined FFA1) (Global) // //The input report // 0x19, 0xe0, // usage - vendor defined (Local) // 0x29, 0xe7, // logical minimum (0) (Local) // 0x15, 0x00, // logical maximum (255) (Local) // 0x25, 0x01, // Report Size (8) (bits) (Local) // 0x95, 0x08, // Report Count (255) (fields) (Local) // 0x75, 0x01, // Input (Data, Variable, Absolute) (Main) // //The output report // 0x81, 0x02, // usage - vendor defined (Local) // 0x95, 0x01, // logical minimum (0) (Local) // 0x75, 0x08, // logical maximum (255) (Local) // 0x81, 0x03, // Report Size (8) (bits) (Local) // 0x95, 0x06, // Report Count (255) (fields) (Local) // 0x75, 0x08, // Output (Data, Variable, Absolute) (Main) //0x15, 0x00, //0x25, 0xff, //0x05, 0x07, //0x19, 0x00, //0x29, 0x65, //0x81, 0x00, //0x25, 0x01, //0x95, 0x05, //0x75, 0x01, //0x05, 0x08, //0x19, 0x01, //0x29, 0x05, //0x91, 0x02, //0x95, 0x01, //0x75, 0x03, //0x91, 0x03, // 0xC0 // End Collection (Main) //}; const u8 usbHidKbdReportDescriptor[HID_KBD_RPT_LEN] = { 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x03, 0x95, 0x05, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x05, 0x91, 0x02, 0x95, 0x01, 0x75, 0x03, 0x91, 0x03, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x25, 0xFF, 0x05, 0x07, 0x19, 0x00, 0x29, 0x65, 0x81, 0x00, 0xc0 }; const u8 usbHidPosReportDescriptor[HID_POS_RPT_LEN] = { 0x05, 0x8c, 0x09, 0x01, 0xa1, 0x01, 0x09, 0x07, 0xa1, 0x02, 0x85, 0x01, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x3f, 0x09, 0xfe, 0x82, 0x02, 0x01, 0xc0, 0x09, 0x08, 0xa1, 0x02, 0x85, 0x02, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x3f, 0x09, 0xfe, 0x82, 0x02, 0x01, 0xc0, 0x09, 0x06, 0xa1, 0x02, 0x85, 0x04, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x3f, 0x09, 0x00, 0x91, 0x96, 0xc0, 0xc0 };