阅读:1280回复:3
晷於WriteFile的 |
|
沙发#
发布于:2002-10-17 09:36
怎么又是你。我发现你对HID Report非常不熟悉,你一定要看USB HID的规范才行。 如果你的Outbufferlength=0,说明你在HID Report中没有定义Output(),当然Writefile不成功。你需要在Hid Report中加上才行。例如:
db 06h, 00h, ffh ; vendor defind usage page 1 db 09h, 01h ; vendor page 1 db 75h, 08h ; Report Size (8) (bits) db 95h, 08h ; Report Count (8) (fields) db 91h, 02h ; Output (Data, Variable,Absolute) 这样的话,你的Outbufferlength就等于8了。 |
|
板凳#
发布于:2002-10-17 15:34
sorry~~~因
|
|
地板#
发布于:2002-10-18 09:23
当然可以用C语言。你可以定义一个HID_REPORT_DESCRIPTOR类型的数组(其实就是UCHAR类型),把这些信息放到里面。
HID_REPORT_DESCRIPTOR ReportDescriptor[] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x04, // USAGE (Joystick) 0xa1, 0x01, // COLLECTION (Application) 0x09, 0x01, // USAGE (Pointer) 0xa1, 0x00, // COLLECTION (Physical) 0x05, 0x09, // USAGE_PAGE (Button) 0x19, 0x01, // USAGE_MINIMUM (Button 1) 。。。。。。。 } 在DeviceExtension中分配适当的内存,在INIT时把上面的数据COPY到分配的内存里面。 当接收到IOCTL_HID_GET_REPORT_DESCRIPTOR时,把这些信息COPY到IRP里面UserBuffer里面即可。具体的可以参考DDK。 RtlCopyMemory((PUCHAR) Irp->UserBuffer, (PUCHAR) DeviceExtension->ReportDescriptor, bytesToCopy); 这次应该很清楚了吧。不过分不要少给吆。:) |
|