在Linux中发送/接收HID报告?
我正在尝试从(用户空间)C ++程序与自定义的硬件进行通信。该设备是HID设备,但不是鼠标/键盘。
在Windows上,我可以使用HIDD_SETOUTPUTREPTERPORT发送报告,然后可以Hidd_getInputReport接收回复。 (生成了不止一个报告,但是那些电话让我指定我想要哪个报告。)
我没有做任何喜欢的事情,所以它很好,很简单。
我很难弄清楚这些调用的简单替代方案是什么。
如果有人可以将我指向文档或代码示例,以说明Linux上的等效操作,我将非常感谢。
谢谢。
I'm trying to communicate to a custom piece of hardware from a (userspace) C++ program. The device is an HID device, but not a mouse/keyboard.
On Windows, I can use HidD_SetOutputReport to send a report, and then HidD_GetInputReport to receive the reply. (There is more than one report being generated, but those calls let me specify which one I want.)
I'm not doing anything fancy, so it's nice and straightforward.
I am having trouble figuring out what the simple Linux alternative to those calls is.
If someone could point me towards documentation or a code example that illustrates equivalent operations on Linux, I would be very grateful.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的设备是HID设备,则用于发送HID报告,您需要写入相应的 /Dev /HID*设备。这将是HIDD_SETOUTPUTEPREPTERTATE。
现在,大多数设备都使用EP0进行向后通信,因此,要获取响应,您需要从相应的 /dev /hid*设备读取。这将Behidd_getInputReport替代。
如果您的硬件没有使用EP0进行通信,则可以从端点描述符中找到信息,其中将在其中定义如何恢复响应。
If your device is a HID device then for sending the HID report you need to write to the corresponding /dev/hid* device. This will be HidD_SetOutputReport alternate.
Most of the devices now using EP0 for backward communication, so for getting the response you need to read from corresponding /dev/hid* device. This will beHidD_GetInputReport alternate.
If your hardware are not using the EP0 for communication then you can find the information from your Endpoint descriptor, in which it will be defined how to get the response back.