You had the right idea for the answer, but the details are not quite
right. HID is not USB. HID is a transport independent protocol (it
just describes how bytes are interpreted, not how they get to the PC).
You should probably write a hid miniport, vhidmini or better yet, the
KMDF HID miniport driver in the 6001 WDK are good places to start. You
don’t need to emulate usb at all, you just need to understand HID
descriptors and HID reports and how to format your data. Matt is
correct that you will need an INF and a cooked up hardware ID for the
HID device in the HID device class, not the keyboard device class. The
device stack looks like this
Kbclass
|
Kbdhid
|
HIDclass PDO
|
±–+
|
HIDclass+your hid minidriver
|
Root PDO
The bigger question you have to answer is how are you going to get the
data to feed into the virtual keyboard to report to the OS? As a HID
miniport, you cannot be opened directly by user mode. Your HID miniport
can open up other devices though and read from them. How you get your
data might change the design, so please let me know and I can point you
in the right direction
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Matthew Carter
Sent: Saturday, June 30, 2007 7:53 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Virtual Keyboard Driver: Where to start?
I’m no driver expert, but since no one else answered I’ll give it a
shot.
It seems to me that if you want to build a keyboard device that kbdclass
attaches to then you are going to need to write a virtual usb port
driver to
use in place of the normal keyboard port driver (usbhid.sys) probably.
You
write an INF file to detect your fake PNP ID and install a keyboard
stack
for that device like keyboard.inf does for normal PS2 and USB keyboards
except with your port driver at the bottom.
I think there’s a sample in the version 6000 WDK in src\hid\vhidmini
that
may be a good starting point to help you enumerate and simulate a basic
virtual USB device, but I don’t think that will get you anywhere near
the
finish line. That helps with some basic usb protocol, but not keyboard
logic I think. You’d probably need to go to www.usb.org to get some
documentation to understand what packets your virtual keyboard should be
sending and how it should be responding to what it receives according to
the
specification, then program all that logic into vhidmini. Instead of
having
your device stack installed with hidusb.sys and kbdclass.sys on top of
that
you would have vhidmini.sys with kbdclass.sys on top of it.
I think you may be in for a lot of work that you aren’t ready for if you
don’t really even have any idea where to begin.
I’d like to write a virtual keyboard driver, but don’t know where to
start.
The driver should create one virtual keyboard device (without
correspondence to any physical one), kbdclass should attach to its
device
stack and it should be “plug-and-playable” (installation &
uninstallation
without restart).
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer