问题描述
RAWINPUT. hid.dwSizeHid包含RAWINPUT.hid的长度. bRawData和与HIDP_CAPS.InputReportByteLength相同.不幸的是,这与实际数据的数量完全无关 RAWINPUT.hid中的字节. bRawData.如何确定RAWINPUT.hid的什么部分. bRawData 有效?或者是RAWINPUT.hid中未使用的部分的错误. bRawData 不是设置为= 0?
RAWINPUT.hid.dwSizeHid contains the length of the RAWINPUT.hid.bRawData and is the same as HIDP_CAPS.InputReportByteLength. Unfortunately this is totally unrelated to the number of actual data bytes in RAWINPUT.hid.bRawData. How do I work out what part of RAWINPUT.hid.bRawData is valid? Or is it a bug that the unused portion of RAWINPUT.hid.bRawData is not set to =0?
这是一个问题,原因是两个类似的设备可能会发送具有相同ID但长度不同的报告.一个例子是 例如id = 3的报告,该报告是该设备上按下的按钮的位字段.仅具有两个按钮的设备可以设置USB描述符,以便仅发送一个字节的数据.具有32个按钮的第二个设备将发送4个字节.因为 当第一个设备发送其一个字节数据时,未设置整个bRawData,字节2-4中可能存在非零数据,这导致rawinput处理程序错误地认为设备中存在更多按钮,并且这些才刚刚 被按下.
The reason this is an issue is that two similar devices may send reports with the same id, but with different lengths. An example would be a report with, say, id=3, which is a bit field of the buttons pressed on that device. A device with only two buttons could set the USB descriptors up so that it only sends one byte of data. A second device with 32 buttons would send, say, 4 bytes. Because the whole of the bRawData is not set when the first device sends its one byte of data there may be non-zero data in bytes 2-4 which results in the rawinput handler erroneously thinking that a device is present with more buttons and that these have just been pressed.
Markus
推荐答案
这篇关于如何在RawInput隐藏结构中确定有效数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!