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.

Thanks

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.

Thanks


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

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.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron, I think it does not work.
Here’s the beginning of my descriptor (before applying the change):

/////////////////////////////////////////////////////////////////////////////////////
0x05,0x01, // Usage Page Generic Desktop
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x09,0x04, // Usage Joystick
0xA1,0x01, // Collection Application
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x85, 0x01, // Report ID 1
/////////////////////////////////////////////////////////////////////////////////////

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.