我是 Windows 驱动程序的新手。
我下载了这个样本,只修复了一个像这样的报告描述符。
HID_REPORT_DESCRIPTOR G_DefaultReportDescriptor[] = {
0x06, 0x00, 0xFF, // USAGE_PAGE (Vender Defined Usage Page)
0x09, 0x01, // USAGE (Vendor Usage 0x01)
0xA1, 0x01, // COLLECTION (Application)
0x85, CONTROL_FEATURE_REPORT_ID, // REPORT_ID (1)
0x09, 0x01, // USAGE (Vendor Usage 0x01)
0x15, 0x00, // LOGICAL_MINIMUM(0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM(255)
0x75, 0x08, // REPORT_SIZE (0x08)
//0x95,FEATURE_REPORT_SIZE_CB, // REPORT_COUNT
0x96, (FEATURE_REPORT_SIZE_CB & 0xff), (FEATURE_REPORT_SIZE_CB >> 8), // REPORT_COUNT
0xB1, 0x00, // FEATURE (Data,Ary,Abs)
0x09, 0x01, // USAGE (Vendor Usage 0x01)
0x75, 0x08, // REPORT_SIZE (0x08)
//0x95,INPUT_REPORT_SIZE_CB, // REPORT_COUNT
0x96, (INPUT_REPORT_SIZE_CB & 0xff), (INPUT_REPORT_SIZE_CB >> 8), // REPORT_COUNT
0x81, 0x00, // INPUT (Data,Ary,Abs)
0x09, 0x01, // USAGE (Vendor Usage 0x01)
0x75, 0x08, // REPORT_SIZE (0x08)
//0x95,OUTPUT_REPORT_SIZE_CB, // REPORT_COUNT
0x96, (OUTPUT_REPORT_SIZE_CB & 0xff), (OUTPUT_REPORT_SIZE_CB >> 8), // REPORT_COUNT
0x91, 0x00, // OUTPUT (Data,Ary,Abs)
0xC0, // END_COLLECTION
};
至
HID_REPORT_DESCRIPTOR G_DefaultReportDescriptor[] = {
0x05,0x01, // USAGE_PAGE (Generic Desktop)
0x09,0x02, // USAGE (Mouse)
0xA1,0x01, // COLLECTION (Application)
0x85,0x01, // REPORT_ID (1)
0x09,0x01, // USAGE (Pointer)
0xA1,0x00, // COLLECTION (Physical)
0x05,0x09, // USAGE Page (Buttons)
0x19,0x01, // USAGE Minimum (01)
0x29,0x03, // USAGE Maximum (03)
0x15,0x00, // LOGICAL_MINIMUM(0)
0x25,0x01, // LOGICAL_MAXIMUM(1)
0x95,0x03, // REPORT_COUNT (3)
0x75,0x01, // REPORT_SIZE (1)
0x81,0x02, // Input (Data, Variable, Absolute)
0x95,0x01, // REPORT_COUNT (1)
0x75,0x05, // REPORT_SIZE (5)
0x81,0x03, // Input (Constant)
0x05,0x01, // USAGE_PAGE (Generic Desktop)
0x09,0x30, // Usage (X)
0x09,0x31, // Usage (Y)
0x15,0x81, // LOGICAL_MINIMUM(-127)
0x25,0x7F, // LOGICAL_MAXIMUM(127)
0x75,0x08, // REPORT_SIZE (8)
0x95,0x02, // REPORT_COUNT (2)
0x81,0x06, // Input (Data, Variable, Relative)
0xC0, // END_COLLECTION
0xC0 // END_COLLECTION
};
结果:
1. 成功安装为 HID 鼠标。
2.运行testApp,CreateFile Failed like this。
....寻找我们的 HID 设备
错误:CreateFile 失败:5
失败:找不到我们的 HID 设备
请帮我。我不明白为什么会这样。