Device Phase Data Description Cmd.Phase.Ofs(rep) Delta Date Time ------ ----- -------------------------------------------------- ---------------- ------------------ ----- ---------- ------------ 11.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 1.1.0(2) 3.2mn 2006-10-04 15:23:12.365 11.0 DI 01 01 01 00 .... 1.2.0 22us 2006-10-04 15:23:12.365 11.0 CTL 23 01 10 00 02 00 00 00 CLEAR FEATURE 3.1.0 45us 2006-10-04 15:23:12.365 11.0 CTL a3 00 00 00 01 00 04 00 GET STATUS 4.1.0 49us 2006-10-04 15:23:12.365 11.0 DI 00 03 00 00 .... 4.2.0 13us 2006-10-04 15:23:12.365 11.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 5.1.0(2) 11us 2006-10-04 15:23:12.365 11.0 DI 01 01 00 00 .... 5.2.0 13us 2006-10-04 15:23:12.365 11.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 7.1.0 116ms 2006-10-04 15:23:12.481 11.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 8.1.0 26ms 2006-10-04 15:23:12.508 11.0 DI 03 01 10 00 .... 8.2.0 32us 2006-10-04 15:23:12.508 11.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 9.1.0 6us 2006-10-04 15:23:12.508 11.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.1.0(2) 26ms 2006-10-04 15:23:12.534 11.0 DI 03 01 00 00 .... 10.2.0 39us 2006-10-04 15:23:12.534 11.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 12.1.0 39ms 2006-10-04 15:23:12.574 11.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 13.1.0 26ms 2006-10-04 15:23:12.600 11.0 DI 03 01 10 00 .... 13.2.0 31us 2006-10-04 15:23:12.600 11.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 14.1.0 6us 2006-10-04 15:23:12.600 11.0 CTL 80 06 00 03 00 00 ff 00 GET DESCRIPTOR 15.1.0 128ms 2006-10-04 15:23:12.728 11.0 DI 04 03 09 04 .... 15.2.0 26ms 2006-10-04 15:23:12.755 11.0 CTL 80 06 03 03 09 04 ff 00 GET DESCRIPTOR 16.1.0 38us 2006-10-04 15:23:12.755 11.0 DI 16 03 32 00 30 00 30 00 37 00 2d 00 30 00 33 00 ..2.0.0.7.-.0.3. 16.2.0 36ms 2006-10-04 15:23:12.792 2d 00 32 00 33 00 -.2.3. 16.2.16 11.0 CTL 80 06 00 02 00 00 ff 00 GET DESCRIPTOR 17.1.0 35us 2006-10-04 15:23:12.792 11.0 DI 0a 02 2e 00 01 01 00 a0 32 00 09 04 00 00 02 03 ........2....... 17.2.0 40ms 2006-10-04 15:23:12.833 01 01 00 00 0a 21 01 00 00 01 22 00 3f 00 08 05 .....!....".?... 17.2.16 11.0 CTL 23 01 01 00 02 00 00 00 CLEAR FEATURE 18.1.0 344ms 2006-10-04 15:23:13.177
修改的配置,接口,端点等描述符结构体 DEVICE_DESCRIPTOR_STRUCT device_descriptor= //设备描述符 { sizeof(DEVICE_DESCRIPTOR_STRUCT), //设备描述符的字节数大小 DEVICE_DESCRIPTOR, //设备描述符类型编号 0x0001, //0x0110, //0x1001, //USB版本号 0x00, //USB分配的设备类代码 0x00, //USB分配的子类代码 0x00, //USB分配的设备协议代码 0x10, //端点0的最大包大小 0x8304, //0x3412, //厂商编号VID,这里只是作为测试用,请使用自己的VID 0x0100, //0x7856, //产品编号PID,这里只是作为测试用,请使用自己的PID 0x0401, //0x0100, //设备出厂编号 0x01, //设备厂商字符串的索引 0x02, //描述产品字符串的索引 0x03, //描述设备序列号字符串的索引 0x01 //可能的配置数量 };
//定义配置,接口,端点等描述符结构体,因为它们是随配置描述符一起返回的 typedef struct _CON_INT_ENDP_DESCRIPTOR_STRUCT { CONFIGURATION_DESCRIPTOR_STRUCT configuration_descriptor; INTERFACE_DESCRIPTOR_STRUCT interface_descriptor; HID_DESCRIPTOR_STRUCT hid_descriptor; ENDPOINT_DESCRIPTOR_STRUCT endpoint_descriptor[ENDPOINT_NUMBER]; }CON_INT_ENDP_DESCRIPTOR_STRUCT;
CON_INT_ENDP_DESCRIPTOR_STRUCT con_int_endp_descriptor= { //configuration_descriptor //配置描述符 { sizeof(CONFIGURATION_DESCRIPTOR_STRUCT), //配置描述符的字节数大小 CONFIGURATION_DESCRIPTOR, //配置描述符类型编号 sizeof(CON_INT_ENDP_DESCRIPTOR_STRUCT), //SWAP16(sizeof(CON_INT_ENDP_DESCRIPTOR_STRUCT)), 0x01, //只包含一个接口 0x01, //该配置的编号 0x00, //iConfiguration字段 0xA0, //采用总线供电,支持远程唤醒 0x32, //0xC8 //从总线获取最大电流400mA }, //interface_descritor //接口描述符 { sizeof(INTERFACE_DESCRIPTOR_STRUCT), //接口描述符的字节数大小 INTERFACE_DESCRIPTOR, //接口描述符类型编号 0x00, //接口编号为0 0x00, //该接口描述符的编号 ENDPOINT_NUMBER, //非0端点数量为2,只使用端点主端点输入和输出 0x03, //人机接口设备(HID)类 0x01, //使用的子类:支持BIOS根启动Boot的子类 0x01, //使用的协议:键盘 0x00 //接口描述符字符串索引 }, //hid_descriptor { sizeof(HID_DESCRIPTOR_STRUCT), //HID描述符的字节数大小 HID_DESCRIPTOR, //HID描述符类型编号 0x0001, //0x0110, //0x1001, //HID类协议版本号,为1.1 0x00, //0x21, //固件的国家地区代号,0x21为美国 NUM_SUB_DESCRIPTORS, //下级描述符的数量 { { REPORT_DESCRIPTOR, //下级描述符为报告描述符 sizeof(KeyBoardReportDescriptor) //SWAP16(sizeof(KeyBoardReportDescriptor)) //下级描述符的长度 } }, }, //endpoint_descriptor[] { { //主端点输入描述 sizeof(ENDPOINT_DESCRIPTOR_STRUCT), //端点描述符的字节数大小 ENDPOINT_DESCRIPTOR, //端点描述符类型编号 MAIN_POINT_IN, //端点号,主输入端点 ENDPOINT_TYPE_INTERRUPT, //使用的传输类型:中断传输 0x0040, //0x4000, //该端点支持的最大包尺寸,64字节 0x20, //0x0A //中断扫描时间:设置为10ms }, { //主端点输出描述 sizeof(ENDPOINT_DESCRIPTOR_STRUCT), //端点描述符的字节数大小 ENDPOINT_DESCRIPTOR, //端点描述符类型编号 MAIN_POINT_OUT, //端点号,主输出端点 ENDPOINT_TYPE_INTERRUPT, //使用的传输类型:中断传输 0x0040, //0x4000, //该端点支持的最大包尺寸,64字节 0x20,//0x0A //中断扫描时间:设置为10ms } } }; |