Multi-function HIDClass driver

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!

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

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.

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.

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.

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.