[英]Initializing Device Interfaces for Windows HID Drivers without WdfDeviceCreateDeviceInterface
I'm working on creating a virtual HID device in Windows 10. To help me with developing the drivers, I've been analyzing the example provided here: https://github.com/Microsoft/Windows-driver-samples/tree/master/hid/vhidmini2 . 我正在努力在Windows 10中创建一个虚拟HID设备。为了帮助我开发驱动程序,我一直在分析这里提供的示例: https : //github.com/Microsoft/Windows-driver-samples/tree/ master / hid / vhidmini2 。
One thing that they do has me stumped: in app/testvhid.c, the application sends data to the driver by finding the device interface of the driver, and sending data to that. 他们所做的一件事让我感到困惑:在app / testvhid.c中,应用程序通过查找驱动程序的设备接口并将数据发送至驱动程序,从而将数据发送至驱动程序。 However, the driver never calls WdfDeviceCreateDeviceInterface, which I had assumed was required to create a device interface.
但是,驱动程序从不调用WdfDeviceCreateDeviceInterface,我以为创建设备接口是必需的。 In fact, there appears to be no mention of interfaces at all in the driver code.
实际上,在驱动程序代码中似乎根本没有提到接口。
My question is: how would one go about accessing an interface for an HID device, when no calls to WdfDeviceCreateDeviceInterface have been made? 我的问题是:当没有调用WdfDeviceCreateDeviceInterface时,如何访问HID设备的接口?
HID device has VID/PID and Usage and Usage page information as the attributes, which you can see in the sample source code. HID设备具有VID / PID和“用法和用法”页面信息作为属性,您可以在示例源代码中看到它们。 The way testvhid.c does is that it enumerates all the HID devices in the system and select the device that matches the VID/PID or Usage/UsagePage you want.
testvhid.c的作用是枚举系统中的所有HID设备,并选择与您想要的VID / PID或Usage / UsagePage匹配的设备。 FYI, user-mode module calls HidD_GetAttributes() to get the information.
仅供参考,用户模式模块调用HidD_GetAttributes()来获取信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.