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 (pressing the Power button or removing the batteries), the PnP-Manager won't recognize the device is gone. Windows still shows the device in the device manager and 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.
Ok, i have to use "HidNotifyPresence". It is prototyped in "hidport.h", but unfortunately not documented yet.
It takes two arguments. The first one is a device object, which might be the FDO. The second one is a BOOLEAN. If true the device will be re-enumerated, else the device is suprise removed.
Since my driver is a filter driver, i need to provide my own PassThrough (shim) miniport driver, which will pass the FDO and "HidNotifyPresence" addresses to the filter driver.