I have implemented an HID minidriver that creates a set of virtual joystick devices.
It responds to IOCTL_HID_GET_REPORT_DESCRIPTOR by creating a report descriptor that contains several (1 to 16) top collections.
Each top collection is seen by the system as a joystick device.
Now, one of my clients asked me to add the option to have ZERO devices.
I had a few ideas. I’d appreciate your comments (harsh as usual):
Create an application that does the equivalent of “Devcon -disable” on all children PDOs of the minidriver.
Send the system a “device removed” message - no idea how to do that.
Create some “empty” report descriptor - I tried to create such an empty report descriptor but failed.
You can do this a couple of ways. Disable is one path, the devcon sample shows how to do it. Another is to create a bus driver below your hid miniport that enumerates your miniports. When you want the joystick to go away, have your bus driver surprise remove the miniport stack. The dynamic bus toaster sample does 100% of what you need here
d
Bent from my phone
From: xxxxx@gmail.commailto:xxxxx Sent: ?4/?10/?2015 8:29 AM To: Windows System Software Devs Interest Listmailto:xxxxx Subject: [ntdev] How to hide or disable HID devices
I have implemented an HID minidriver that creates a set of virtual joystick devices. It responds to IOCTL_HID_GET_REPORT_DESCRIPTOR by creating a report descriptor that contains several (1 to 16) top collections. Each top collection is seen by the system as a joystick device.
Now, one of my clients asked me to add the option to have ZERO devices. I had a few ideas. I’d appreciate your comments (harsh as usual): 1. Create an application that does the equivalent of “Devcon -disable” on all children PDOs of the minidriver. 2. Send the system a “device removed” message - no idea how to do that. 3. Create some “empty” report descriptor - I tried to create such an empty report descriptor but failed.
Thank you doron.
Major change in the architecture is out of the question at this point.
I was wondering if it was not possible to do something with the report descriptor that will tell the system that there are zero devices.
Currently I add/remove PDOs by programmatically controlling the number of top-level reports (and their IDs). This method allows me to to configure 1 to 16 joystick devices. I hoped there would be an option for a report descriptor saying “no devices”.
BTW, I made some tests and found out that if I replace the Usage (under Generic Desktop Page) from Joystick (0x04) to Pointer (0x01) I get what I want. However, this is a dangerous workaround I’d rather not use.
I would use a custom usage page, not pointer for your zero case.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Sunday, April 12, 2015 10:41 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to hide or disable HID devices
Thank you doron.
Major change in the architecture is out of the question at this point.
I was wondering if it was not possible to do something with the report descriptor that will tell the system that there are zero devices.
Currently I add/remove PDOs by programmatically controlling the number of top-level reports (and their IDs). This method allows me to to configure 1 to 16 joystick devices. I hoped there would be an option for a report descriptor saying “no devices”.
BTW, I made some tests and found out that if I replace the Usage (under Generic Desktop Page) from Joystick (0x04) to Pointer (0x01) I get what I want. However, this is a dangerous workaround I’d rather not use.
I tried to replace the Usage Joystick (0x09,0x04,) with one of the reserved values (0x09,0x0A,) but it has no effect.
As I wrote (0x09,0x01,) gets me what I want but this is not a reliable solution.