Can't connect to HID device on some computers

Sasha 6 Reputation points
2020-06-25T03:57:12.823+00:00

I've written a C# UWP app that connects to a custom HID device. It uses a DeviceWatcher to detect the device when it is connected to the computer. DeviceWatcher's Added() event handler provides the ID for the device and then I pass that as a parameter in HidDevice.FromIdAsync() to open a handle to the device. This works fine on most computers, but there are a few computers where the call to HidDevice.FromIdAsync() returns null.

I believe it's not a code problem because this code works consistently on many computers. Usually a null response from HidDevice.FromIdAsync() means that there's a permissions problem, but I can't figure out what kind of permissions outside the app itself could be blocking the device handle from opening. I don't see anything in the Windows Event Viewer (or possibly I don't know where to look). I'm pretty sure there's no other app opening a handle to my device and blocking my app from getting the handle. I'm running Windows 10 version 10.0.18363.657 on systems both of my primary test systems (one that works and one that doesn't). The driver for the device that windows chose to load appears the same on both computers, when viewed in device manager. Any ideas about what could be different between the working computer and the non-working one would be appreciated. Thanks!

Universal Windows Platform (UWP)
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.