KMDF USB Filter Configurations

I’m wring a KMDF lower filter for a USB driver. This driver selects a
configuration other than 1. How can I create a WdfUsbTargetDevice for
my filter to use without interfering with the FDO? As I read the code,
KMDF reads the first configuration descriptor and uses it to configure
itself. I need it to use configuration 5, but I can’t be sending my own
SelectConfiguration request, because that will break all of the
interface and pipe handles that the FDO already owns.

I’m already intercepting his SelectConfiguration call. I tried passing
his URB into WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_URB, but I get
STATUS_INVALID_DEVICE_REQUEST. If I use
…PARAMS_INIT_INTERFACE_DESCRIPTORS, I don’t know how to get the
configuration handle to fill in his URB.

In the worst case, I can just concoct my own URBs without using the
abstraction, but it seems like there must be a way.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

In the worst case, I can just concoct my own URBs without
using the abstraction, but it seems like there must be a way.

One thing I’ve done in this situation is make myself be a bus driver, that is, install yourself as the FDO, concoct a new PDO, and load the existing driver on that. Basically, just virtualize the entire thing. That solves your pipe handle problem. Plus, you can just open the FDO of your bus driver directly and not have to deal with control devices, raw PDO’s, or WMI to talk to your filter.

Another time, WdfUsbTargetDeviceSelectConfig() instantly blue screened my machine because of a bug in the combination of Win2k and the way KMDF was dealing in URBs. That time I made a lower filter to my KMDF function driver that intercepted the internal IOCTLs that were causing the blue screen and faked success back upwards. Seems like this wouldn’t really help you though, making a lower lower filter to your lower filter.

But no, you shouldn’t assume this can be done. I think you’d agree that the value-add support for non-first configuration descriptors is “limited”.