Telling the PnP the Device is gone

Hi,

i’m currently developing a KMDF HID minidriver for the Nintendo Wii Remote. My HID minidriver replaces the HidBth minidriver for the HIDClass driver (I’m using the KMDF HID minidriver sample, where it is actually a filter driver and uses this “kmdfhidminidriver” to forward all requests).

So my problem is, when i power off the Wii Remote, the PnP-Manager won’t recognize the device is gone. Windows still thinks everything is fine and running. The only hint, that the device is gone is, that the L2CAP-Channel is closed and i get the L2CAP-Callback called with Indicator Code “RemoteDisconnect”.

My question is, how do i signal the PnP-Manager the device has disconnected? I tried using “WdfDeviceSetDeviceState” with “Removed” set to true. But then the Device Manager shows an driver error (Code 24). I would like to have a solution, where the device gets removed from the Device Manager without any error, like unplugging an USB device.

Additional information: i’m using WDK 8 and WDF 1.11; driver target systems are Win 7 and 8.

You need the true hid miniport to pass the address of HidNotifyPresence to your KMDF miniport and call it based on the connection status. See http://www.winvistatips.com/threads/hidnotifypresence.185644/

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@outlook.com
Sent: Friday, June 20, 2014 2:40 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Telling the PnP the Device is gone

Hi,

i’m currently developing a KMDF HID minidriver for the Nintendo Wii Remote. My HID minidriver replaces the HidBth minidriver for the HIDClass driver (I’m using the KMDF HID minidriver sample, where it is actually a filter driver and uses this “kmdfhidminidriver” to forward all requests).

So my problem is, when i power off the Wii Remote, the PnP-Manager won’t recognize the device is gone. Windows still thinks everything is fine and running. The only hint, that the device is gone is, that the L2CAP-Channel is closed and i get the L2CAP-Callback called with Indicator Code “RemoteDisconnect”.

My question is, how do i signal the PnP-Manager the device has disconnected? I tried using “WdfDeviceSetDeviceState” with “Removed” set to true. But then the Device Manager shows an driver error (Code 24). I would like to have a solution, where the device gets removed from the Device Manager without any error, like unplugging an USB device.

Additional information: i’m using WDK 8 and WDF 1.11; driver target systems are Win 7 and 8.


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

Ok, thanks for the hint.

Could you give me some advice on how to achieve this? I’m quite new to driver development, so i don’t have a clue.

As from my search for “HidNotifyPresence”, it needs the FDO as first argument. But my driver is a filter driver, so i don’t the address of the FDO. Additionally the true hid miniport is the Microsoft “MsHidKmdf” driver. Therefore i don’t have access to it, to make it pass me those addresses. Or at least i don’t know how.

Besides how do other profile do this? I don’t think they will use “HidNotifyPresence”.

Other profiles don’t have the problem of persistent presence expectations that HID does. When the os sees a HID keyboard, it assumes certain things and the hid miniport doesn’t want to lie about it being present in anticipation of a connection. Other profile don’t surface as a new pnp stack so that also is unique here. The only usbfx2hid sample has the hid pass through driver in addition to the filter, you can create your own mshidkmdf (with its own name)

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@outlook.com
Sent: Sunday, June 22, 2014 5:38 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Telling the PnP the Device is gone

Ok, thanks for the hint.

Could you give me some advice on how to achieve this? I’m quite new to driver development, so i don’t have a clue.

As from my search for “HidNotifyPresence”, it needs the FDO as first argument. But my driver is a filter driver, so i don’t the address of the FDO. Additionally the true hid miniport is the Microsoft “MsHidKmdf” driver. Therefore i don’t have access to it, to make it pass me those addresses. Or at least i don’t know how.

Besides how do other profile do this? I don’t think they will use “HidNotifyPresence”.


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

Ok, i have implemented my own hid miniport, which is passing me down the FDO and HidNotifyPresence addresses.

Problem is, when i call HidNotifyPresence nothing really happens. With false as second argument, the device gets marked as offline in the PC-Settings on Windows 8. On Windows 7 or with true as second argument nothing happens at all. In all cases the device remains in the device manager and is not surprise removed.

This affects the children enumerated by hidclass. View by connection and see if the children disappear.

d

Bent from my phone


From: xxxxx@outlook.commailto:xxxxx
Sent: ?6/?27/?2014 10:01 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Telling the PnP the Device is gone

Ok, i have implemented my own hid miniport, which is passing me down the FDO and HidNotifyPresence addresses.

Problem is, when i call HidNotifyPresence nothing really happens. With false as second argument, the device gets marked as offline in the PC-Settings on Windows 8. On Windows 7 or with true as second argument nothing happens at all. In all cases the device remains in the device manager and is not surprise removed.


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>

Oh, well…yes you’re right. The child node (HID-compliant game controller) disappears. Sorry, i didn’t recognize it. I was excepting that everything enumerated from Bthenum, that is Wii Remote related, would be removed.

However, i would like to have the behavior, like the user removed the device from the PC-Settings. So every that particular Wii Remote related device gets removed and i can reconnect it.
Currently when i turn off the Wii Remote the Bluetooth HID device is still present and Windows won’t accept the same Wii Remote to be reconnected. First the user has to remove the Wii Remote(Nintendo RVL-CNT-01 device) via PC-Settings or devices and printers.

That is not possible from a driver. You need to debug why you can’t reconnect while keeping your driver enumerated.

d

Bent from my phone


From: xxxxx@outlook.commailto:xxxxx
Sent: ?6/?27/?2014 11:33 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Telling the PnP the Device is gone

Oh, well…yes you’re right. The child node (HID-compliant game controller) disappears. Sorry, i didn’t recognize it. I was excepting that everything enumerated from Bthenum, that is Wii Remote related, would be removed.

However, i would like to have the behavior, like the user removed the device from the PC-Settings. So every that particular Wii Remote related device gets removed and i can reconnect it.
Currently when i turn off the Wii Remote the Bluetooth HID device is still present and Windows won’t accept the same Wii Remote to be reconnected. First the user has to remove the Wii Remote(Nintendo RVL-CNT-01 device) via PC-Settings or devices and printers.


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>