Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


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/


WBF driver for USB isochronous device

Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121

We have an USB device which sends data using isochronous endpoint and our customer would like to have WBF (Windows Biometric Framework) driver for it. I have written several WBF drivers using UMDF 1 and 2 but has no experience with isochronous USB devices and AFAIK UMDF doesn't support it. Our WBF driver has to be UMDF as we use a big library for image processing which can't be run in kernel.

So I wonder how to perform this task. It seems WinUsb supports isochronous endpoints since Win 8.1 version and WinUsb was originally used as I/O target for UMDF drivers. However, I don't see necessary UMDF function to utilize this functionality. Am I missing something?

As the next possibility docs state "UMDF with a custom KMDF filter on WinUsb or custom KMDF I/O target". Here I'm surely missing something because I don't quite understand why there should be KMDF filter on WinUsb. Can somebody elaborate? Seems I forgot a lot of things and need to refresh...

Ideas welcome. TIA

Comments

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121

    Nobody? OK, something simpler. Is it possible install WinUsb driver for an USB device and layer UMDF driver over it so it can call WinUSB APIs via IOCTLs? I guess it is but how exactly? Is there any similar sample available?

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,831

    UMDF 2 is very similar to KMDF. You might as well just do your own KMDF driver to handle the USB instead of using WinUSB.

    Tim Roberts, [email protected]
    Software Wizard Emeritus

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121
    edited August 2023

    I can't. The driver has to use a big user mode library for image processing which can't be ported to kernel. WBF driver has to process sensor output itself as its main interface IOCTL returns images. The processing is non-trivial and usually needs a lot of heap and stack.

    I don't resist on using WinUsb but currently it seems as the best option because it seems to do everything I need.

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121

    OK, thinking about it... Can I in an UMDF 2 driver EvtDevicePrepareHardware() callback just open WinUsb device and make all necessary preparation using WinUsb API? I mean instead of WdfUsbTargetDeviceCreate() and all other stuff.

    The other part is installation. I guess WinUsb could be installed as LowerFilter as it was for UMDF 1 but how to get the right device instance?

    Sorry for possibly dumb questions, I'm trying to solve the original problem described in the first post :)

  • MBond2MBond2 Member Posts: 705

    Can you do the image processing in a UM service and use an inverted call with KMDF? This is a common pattern when 'complex' processing of raw data is required. It performs well in most environments, and it is much easier to debug and maintain a UM service than complex logic embedded in any driver

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121

    It is possible but isn't it exactly what is UMDF driver for and what is basically doing? I see it as unnecessary complication and parallel design to UMDF.

    We have a pattern for WBF drivers. I write a skeleton which handles USB communication at lower end and and WBF IOCTLs at upper end and others devs give me a library for data/image processing which I feed with data. In this particular case the only problem is UMDF doesn't support isochronous endpoints for reasons I don't understand.

    So I'm looking for a way how to avoid this UMDF limitation and direct calls to WinUsb seem like a way. Why to write yet another kernel driver when this one does everything I need (and Microsoft is responsible for possible BSODs? ;-)).

    I'm just not sure if it is possible and I expected somebody here knows an answer. Nobody did something like this?

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,831

    Isochronous is quite rare outside of audio and video, and the standard drivers handle those.

    Tim Roberts, [email protected]
    Software Wizard Emeritus

  • Xiaofan_ChenXiaofan_Chen Member - All Emails Posts: 281

    @Tim_Roberts said:
    Isochronous is quite rare outside of audio and video, and the standard drivers handle those.

    Indeed. I just checked libfprint2 (mainly for Linux) and it does not seem to support isochronous transfer either. It is using libgusb/libusb (user space) as the underlying library for USB finger print sensors.
    https://fprint.freedesktop.org/libfprint-dev/libfprint-2-USB-transfer-helpers.html

  • Xiaofan_ChenXiaofan_Chen Member - All Emails Posts: 281

    Sorry but I do not know much about WBF (Windows Biometric Framework). Is it possible to just use WinUSB driver for the device and write everything under user space?

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121
    edited August 2023

    Isochronous is quite rare outside of audio and video, and the standard drivers handle those.

    Yes but when they added isochronous support to WinUsb, it could be added to UMDF as well. I looked to WBF sources and it seems it should be possible the same way as other USB APIs.

    In our case it is rather old optic sensor which was probably mentioned to use as a camera through UVC protocol but our customer would like to have a WBF driver for it. So I'm looking for a way how to achieve it (if even possible).

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121

    Sorry but I do not know much about WBF (Windows Biometric Framework). Is it possible to just use WinUSB driver for the device and write everything under user space?

    That's what I want. The problem is user mode part has to be UMDF driver because it exposes IOCTL interface.

  • Xiaofan_ChenXiaofan_Chen Member - All Emails Posts: 281

    @Michal_Vodicka said:

    Sorry but I do not know much about WBF (Windows Biometric Framework). Is it possible to just use WinUSB driver for the device and write everything under user space?

    That's what I want. The problem is user mode part has to be UMDF driver because it exposes IOCTL interface.

    I am actually suggesting to use WinUSB API only and not using the WBF (Windows Biometric Framework) at all. But I am not so sure if this is feasible or not.

  • Michal_VodickaMichal_Vodicka Member - All Emails Posts: 121
    edited August 2023

    Unfortunetely not. WBF is the requirement (it has conseqeunces as integration to Windows Hello).

    Actually, it is the only requirement here and if it can't be done, the project won't start. That's why I'm asking if it is possible and how :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online