Creating a virtual HID device
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 wou开发者_如何学Gold 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. :(
Some people have had luck with the vmulti project as a base http://code.google.com/p/vmulti/
You sholud write a driver, then use DevCon
(Device Console Tool) with install
option.
cmdInstall
:
A variation of cmdUpdate to install a driver when there is no associated hardware. It creates a new root-enumerated device instance and associates it with a made up hardware ID specified on the command line (which should correspond to a hardware ID in the INF). This cannot be done on a remote machine or in the context of Wow64.
http://code.msdn.microsoft.com/windowshardware/DevCon-Sample-4e95d71c
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544780%28v=vs.85%29.aspx
see the vhidmini ddk sample driver. It was in the version 1830 DDK but is not in the latest version. alternatively the hidfake sample in Oney's book.
See http://www.microsoft.com/mspress/books/sampchap/6262.aspx
精彩评论