Creating a virtual HID device

jsmith picture jsmith · Jun 28, 2011 · Viewed 15.8k times · Source

I'd like to create a virtual HID device (emulate it with a driver).

It must be visible to clients that implement standard HID detection:

  • Call HidD_GetHidGuid() – Get the HID device class GUID
  • Call SetupDiGetClassDevs() – Get a handle to a set of devices which implement the HID interface
  • Call SetupDiEnumDeviceInterfaces() – For each device in the returned set of devices, obtain the interface information for all exposed HID interfaces.
  • Call SetupDiGetDeviceInterfaceDetail() – For each interface obtained in the previous call, get the detailed information block for that interface. This detailed information includes the string that can be passed to CreateFile() to open a handle to the device
  • Call SetupDiDestroyDeviceInfoList() – Free up the device information set that was obtained in the call to SetupDiGetClassDevs().

The device should also support reading, so CreateFile / ReadFile would return data supplied by me from the driver.

I don't really know where to begin, as I don't have a lot of exp. in kernel dev. :(

Answer

djp picture djp · Jul 2, 2011

Some people have had luck with the vmulti project as a base http://code.google.com/p/vmulti/