Closed AnnikaJoo closed 1 year ago
Thank you for noticing this. This is not a known issue.
I tried it with a few devices right now, it works ok for most of them - I can add and remove them many times and it always works.
But I found one device that triggers the added event only one time. I will investigate.
I have found out that this sometimes stops working for unknown reason for some devices:
"SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_USBControllerDevice'"
This always works for all devices, but it is CPU intensive:
"SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_PnPEntity'"
I will make a new NuGet version and will provide this as an option.
The default option will be Win32_USBControllerDevice
which works for most devices - and you will be able to choose Win32_PnPEntity
which works for all devices, but is more CPU intensive.
Thanks for your quick fix. With the option it works now :)
Library version
10.1.0.1
OS & OS version
Windows 10
Describe the bug
Hello all,
I am using your Nuget Package in my application to determine if specific USB-devices are added or removed. On Windows I have the problem that this functionality works only two times and after that the event is not triggered anymore. Is this a known issue or what could be responsible for this?
To Reproduce
Expected behavior
I expect the events UsbDeviceRemoved and UsbDeviceAdded to be triggered on every usb change