在Windows上获取HID报告的长度 [英] Getting the Length of HID Reports on WIndows

查看:500
本文介绍了在Windows上获取HID报告的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

成功调用HidD_GetFeature()会返回TRUE.它不以任何方式返回报告中的字节数.

我决定在HID.dll API中必须有一个函数,该函数可以为我提供每个报告中的字节数(从HID描述符中解析).请记住,我要查找的是特定报告中包含的字节数,即:功能报告1.

HidD_GetCaps()将为我提供给定类型的所有报告中的最大字节数(即:最大功能报告长度).它不会给我具体报告的篇幅.

我没有找到可以提供此信息的功能.我决定也许我只能得到报告描述符,然后自己弄清楚.我没有发现任何能给我报告描述符的功能.我可以获得物理描述符,但没有报表描述符.

我被困住了.任何人有任何想法吗?

Calling HidD_GetFeature() returns TRUE on success. It does not return in any way the number of bytes in the report.

I decided there must be a function in the HID.dll API which would give me the number of bytes in each report (as parsed from the HID Descriptor). Keep in mind, what I''m looking for is the number of bytes contained in a specific report, ie: Feature Report #1.

HidD_GetCaps() will give me the Maximum number of bytes in all reports of a given type (ie: max feature report length). It will not give me the length of a specific report.

I found no functions which will give me this information. I decided maybe I could just get the Report Descriptor, and figure it out myself. I found no funcitons which would give me the report descriptor either. I can get the Physical Descriptor, but not the Report Descriptor.

I''m stuck. Anyone have any ideas?

推荐答案

调用HidD_GetFeature时,请将缓冲区中的第一个字节设置为要获取的功能报告的报告ID(如果顶部是-级别集合未指定报告ID,您可以将该位设置为零).然后,您可以根据报告ID解析缓冲区的其余部分.由于您知道报告ID,因此您应该知道数据在缓冲区中的布局方式.
据我所知,如果您不知道数据甚至报告ID的布局,都可以使用
When calling HidD_GetFeature you set the first byte in the buffer to the Report ID of the feature report you want to get (if the top-level collection doesn''t specify a Report ID, you set that bit to zero). Then you can parse the rest of the buffer according to the Report ID. Since you know the Report ID you should know how the data is laid out in the buffer.
As far as I know, if you don''t know the layout of the data or even the Report IDs, you can use the HIDClass Support Routines[^] (HidD_GetPreparsedData, HidP_GetValueCaps, HidP_GetButtonCaps...) to discover the preparsed data of the top-level collection you''re interested in and deal with the report. Preparsed data represents a top-level collection''s part of the report descriptor.


这篇关于在Windows上获取HID报告的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆