USB device upper filter in KMDF sending URBs to device PDO directly

Discussion in 'Windows Vista Drivers' started by balachandar.swami, Feb 26, 2007.

  1. Hello All:

    I am writing a USB device upper filter in KMDF which will filter few
    IOCTLs calls and send vendor specific controls requests
    (synchronously) to the device PDO bypassing the FDO. I see that I can
    accomplish this by getting the WDM physical device object and then
    creating and sending the URBs to this object in old WDM way.

    What I wanted to know is, can I do this using KMDF USB functions ? Or
    is it possible to get a IO Target for the pdo?

    Any directions or pointers or welcome.

    Thanks in advance.
    balachandar.swami, Feb 26, 2007
    1. Advertisements

  2. In order to do that you have to a create a remote target using the PDO as
    your target deviceobject and send the request. You wouldn't be able to use
    USB target APIs to format the request because the filter doesn't own the
    device and it hasn't configured the device using KMDF usb target DDIs. So
    none of the usbtarget DDI can be used.

    However, you can format the URB yourself and send it to the target using
    regular target APIs. That way you can leverage all the values of I/O target.

    For an example on how to format the URB and send it to the stack, look at
    the USBSamp\isorw.c file.

    For an example on how to create a remote target, look at the toastmon
    sample. Instead of opening the target by name, you should do by using
    existing device init macro - providing PDO as the target deviceobject. Makes

    Eliyas Yakub [MSFT], Feb 27, 2007
    1. Advertisements

  3. Thanks Eliyas for the information. That was helpful. I realized later
    that I will not be able to use USB target APIs and your reply
    confirmed that. I was able to use regular target APIs to send the
    manually formatted URB.

    Thanks again.
    balachandar.swami, Feb 27, 2007
  4. Is there any plan in the future to allow usage of the KMDF USB APIs
    (or more generally I suppose, any of the specialized I/O target
    functions) with a remote I/O target?

    That would have been helpful here, even though we're trying to do
    something fairly basic in this case.
    chris.aseltine, Feb 28, 2007
  5. nope, it is not a planned feature. how woudl the remote target know
    anything about the pipe information? like the PIPEHANDLE? You can use the
    remote IO target and then allocate a WDFMEMORY to use as the URB. All you
    lose is the formatting of the URB itself (which you now have to do manually)

    Doron Holan [MS], Feb 28, 2007
  6. Well, I guess my idea was that you would call something similar to
    WdfUsbTargetDeviceCreate() on the remote I/O target. Then KMDF would
    retrieve the config descriptor and so on, and build up its information
    about pipes, etc. the same way it does now.

    The underlying idea being that instead of KMDF submitting its retrieve
    config and select config, interface URBs, etc., to the next lower
    driver in the stack, they could be sent to an arbitrary I/O target.
    chris.aseltine, Feb 28, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.