Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hello,
I am a beginner in kmdf driver development.
I would like to just try creating a simple driver to read data from my mouse ( I don't want the mouse to work, just get the data sent on the USB ).
I used the "kmdf_enumswitches" kmdf template as it is supposed to read continous data on the USB (?) but the function "WdfUsbTargetDeviceCreateWithParameters" returns "STATUS_INVALID_DEVICE_REQUEST"
My guess is that the system knows it is a HID mouse and don't let me open an USB handle to it.
Maybe what I am trying to do is not doable.
In this case, I thought about using an Arduino Due to send data to the driver, would that be an easier approach?
Thanks in advance
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Kernel Debugging | 30 January 2023 | Live, Online |
Developing Minifilters | 20 March 2023 | Live, Online |
Internals & Software Drivers | 17 April 2023 | Live, Online |
Writing WDF Drivers | 22 May 2023 | Live, Online |
Comments
BUT… what are you trying to learn? There may be easier paths to follow if you can state your goals.
Thanks for you answer,
I just want to demonstrate for a studies project how to retrieve data from a hardware using a windows driver.
I had in mind not to build a filter driver (as it would mean I just get the data from an already working windows driver that I didn't code myself?), and rather be the first part of the stack: just the hardware and my driver, but maybe it is not possible?
I would like just the raw usb data (without even taking into account that it is a hid device).
I think you're unclear about the architecture of USB. The only component that talks directly to the hardware is the Host Controller Driver. All other drivers in the USB stack pass around URBs (USB Request Blocks) as normal IRPs. Because of that, you might as well use a filter driver examine the URBs that get passed around during normal mouse operation.
It is possible for you to replace the HID driver with your own custom driver, or even with WinUSB to allow you to drive it from user mode. However, you will need to read and understand the USB Specification and the USB HID Specification in order to understand the protocols you need to follow.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Replacing the microsoft usb drivers with my own custom driver would definitely work, but I think it's a tough task for a beginner.
I read some more microsoft docs and things are starting to get clearer.
So let's say I have a hardware HID device, that has extra features that I need to handle. If I am right, what I should do is build a function driver that binds to the HID class Windows driver?
HID is not a particularly good example, because the operating system already has full driver support. No kernel code is required. Keyboards and mice don't have "extra functions"; they follow the spec, and the system can handle the spec. For devices other than keyboards and mice, the user mode HID library can do anything you need to do.
Non-HID USB devices are fun to play with. There are dozens and dozens of "USB experimenter kits" that you can play with.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.