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/


Multi-function HIDClass driver

mastermindmastermind Member Posts: 2

Hello,

I am trying to understand better the concept of Multi-function HIDClass driver mentioned in the HW ID section of HIDClass docs:

https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hidclass-hardware-ids-for-top-level-collections

Unfortunately Google/Gihub are not helping me much with this topic.

Where can I get info / examples? How can I create one and how flexible it is? Where/how I define the multiple functions? I understand how to define multiple TLCs so HiDClass will create each with a different HW ID but for multi-function I have found no info.

My goal is creating a single HID driver that can have two different functions, each possibly with multiple TLCs. Then I can use a single rawPDO to interface/talk with it from user mode (this is a software driver to simulate different HID devices). The alternative would be creating/installing two separate (almost identical) HID drivers, one per HID device type, each with a separate rawPDO interface so user space apps can talk to them. I think this is less clean due to the multiple drivers installation so if multi-function allows me having a single driver it would be significantly cleaner.

Thanks in advance!

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,378

    Are you the same person as "J Bernard" who just asked essentially the same question?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • mastermindmastermind Member Posts: 2

    Hi Tim,

    no, I am not J Bernard, what a coincidence. I assume you refer to the question "Is it possible to use WCID with the composite parent of a multi-interface device ?" I read the answer and still I am a bit clueless about the way I would configure multi-function for software HID devices (my question).

    I am guessing that I can use "composite" as a keyword with Google as from your comment looks like composite == multi-function? I also now realized that in the MSFT article it mentions: "z(2) two hex digits 0x00-0xFF Interface number (only used with composite USB devices.)" so I am wondering if what I want to do is even possible or only available if the transport is USB. Right now my driver is simply a lower filter of mshidkmdf.

    Thanks.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,378

    I was hoping Doron would chime it; he is truly the HID expert.

    Yes, I believe they are using the phrase "multi-function" to refer to multiple interfaces. A USB device can have multiple interfaces -- even multiple HID interfaces. Absent an IAD descriptor, each interface is assigned to a driver. Each of those interfaces can have one or more top-level collections. Each top-level collection results in a separate HID device.

    So, I don't think they are introducing anything new on this page. I think they're just trying to show you what the HID hardware IDs would be for the various combinations of one/many interfaces and one/many top-level collections.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Pavel_APavel_A Member Posts: 2,822
    edited July 11

    Correct, HID multifunction devices can be made both as generic USB multifunction (interfaces) and as multiple TLCs on the same function/interface.
    I did both variants in firmware some time ago, the latter with three TLCs: keyboard, mouse and function keys. Worked well with Win 10.

    But there may be complications, as IIRC Windows may cache USB descriptors (including the HID report descriptors). This may interfere with your "simulation".
    So, agree with Mr. Roberts - Doron's opinion would be very useful.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,378

    Number of functions supported by the underlying transport

    Well, sort of. For a multi-interface device, usbccgp will create multiple PDOs, so there will be multiple instances of the HID class driver. Each instance handles one interface. It will create a PDO for each top-level collection.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

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!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online