Hi all,
I’m at my first experience with WDF and I’m using it to write a HID upper filter that is supposed to load when a specific HID\vid_?&pid_? has been found.
The inf file doesn’t have anything special and doesn’t load any FDO since I want to sit on top of the raw pdo created by hidclass.sys and be transparent. So I figured an upperfilter is what I want.
Now the funky thing. As I install my driver (manually using the device manager and selecting the inf file for the HID-compliant device entry) I see its DriverEntry being called and nothing more. The AddDevice never gets called.
Then, I uninstall the driver reverting back to the system’s one and I force windows to load the filter on the usbhid stack by opening the registry and adding manually the UpperFilters value in the entry for my device (don’t ask me why I do this, it was a test for something else and I found out this behaviour). Unplug/replug, and the filter gets loaded correctly AND its AddDevice callback gets called. Of course nothing more since I’m on the wrong driver stack.
Now the funny part. I remove the value, unplug/replug, the driver is not loaded anymore. I reinstall it in the HID entry as I did at the beginning and… pufff: now it works fine.
I can see my AddDevice being called and everything else works just fine.
- Is it sign of something wrong I’m doing or something strange in the WDF framework?
Another thing: once my filter is alive and kicking, I want it to dump the HID reports coming from the device. In order to do that, I set a IoRead callback which in turn sets a CompletionRoutine. I’d expect to be able to access the IO buffer from there and make a dump of it but WdfRequestRetrieveInputMemory fails with a STATUS_INVALID_DEVICE_REQUEST code. This would suggest the IO is set for NEITHER_IO however this seems strange for a system driver AND doesn’t match with this post by doron holan http://blogs.msdn.com/doronh/archive/2007/03/26/filtering-hid-collections-and-setting-i-o-flags.aspx
- Does the WDF propagate correctly the flags? Is there anything I can do to check that? Is it something else?
Thank you very much in advance, I’ll appreciate your help.
Stra
Regarding the second point of my post: I don’t know what I was thinking when I decided to use WdfRequestRetrieveInputMemory to serve an IoRead instead of the (correct) WdfRequestRetrieveOutputMemory that of course works like a charm.
My bad.
The first issue, which is the most obscure to me still holds though. I found
http://www.tech-archive.net/Archive/Development/microsoft.public.development.device.drivers/2006-07/msg00177.html
which may or may not be related.
Stra
The AddDevice problems have to do with your INF, nothing to do with KMDF. Instead of installing your driver as a filter in the INF, install it as the service. See if that helps. IN the driver you should still call WdfDeviceInitSetFilter though b/c the PDO will be the power policy owner and do the S->D state mapping.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Saturday, December 08, 2007 10:33 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WDF: funky HID filter behaviour.
Regarding the second point of my post: I don’t know what I was thinking when I decided to use WdfRequestRetrieveInputMemory to serve an IoRead instead of the (correct) WdfRequestRetrieveOutputMemory that of course works like a charm.
My bad.
The first issue, which is the most obscure to me still holds though. I found
http://www.tech-archive.net/Archive/Development/microsoft.public.development.device.drivers/2006-07/msg00177.html
which may or may not be related.
Stra
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hi Doron,
thank you for the advice, it worked!
Just out of curiosity: is there a specific reason why that happens?
Thanks,
Stra.
Not sure, but filtering on top of a stack with no service is a bit weird conceptually. The problem here is that setup has a view of the stack and the drivers w/in the stack have a slightly different view with respect to policy and roles of each device w/in the stack.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@laurenzano.it
Sent: Monday, December 10, 2007 2:59 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WDF: funky HID filter behaviour.
Hi Doron,
thank you for the advice, it worked!
Just out of curiosity: is there a specific reason why that happens?
Thanks,
Stra.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer