阅读:3589回复:1
HID 设备 Readfile 失败 问题
自制 HID设备,report ID 17 为 Output , Report ID 18 为 Input. endpoint 1 为中断输入和输出。
Writefile 没问题, 能收到 report ID 17的数据包,然后发回Report ID 18给计算机, 但Readfile就返回0. Bushound能看到数据,单片机确实有发数据包。 Result = ReadFile (ReadHandle, InputReport, 65, &NumberOfBytesRead, (LPOVERLAPPED) &HIDOverlapped); Result = WriteFile (DeviceHandle, OutputReport, 65, &BytesWritten, NULL); |
|
沙发#
发布于:2010-09-02 11:10
我的WriteFile行了,ReadFile不行,读不到数据
单片机报表描述这这样的,不知道是怎么回事 code const hid_report_descriptor HIDREPORTDESC = { 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) 0x09, 0x01, // USAGE (Vendor Usage 1) 0xa1, 0x01, // COLLECTION (Application) 0x85, OUT_ID, //OUT_BLINK_PATTERNID 0x01 Report ID 0x95, OUT_Size, // 8 REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x85, OUT_BLINK_ENABLEID, // Report ID 0x95, OUT_BLINK_ENABLESize, // REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x85, OUT_BLINK_RATEID, // Report ID 0x95, OUT_BLINK_RATESize, // REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x85, IN_ID, // 0x04 Report ID 0x95, IN_Size, // REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x85, IN_BLINK_STATSID, //IN_BLINK_STATSID=0x05 Report ID 0x95, IN_BLINK_STATSSIZE, // IN_BLINK_STATSSIZE=0x08 REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x85, FEATURE_BLINK_DIMMERID, // Report ID 0x95, FEATURE_BLINK_DIMMERSIZE,// REPORT_COUNT () 0x75, 0x08, // REPORT_SIZE (8) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x09, 0x01, // USAGE (Vendor Usage 1) 0xB1, 0x02, // FEATURE (Data,Var,Abs) 0xC0 // end Application Collection }; |
|