Firstly, I should point out that I have added the device that I need to talk to in to my app's manifest, and I am able to successfully talk to the device. I am able to get this device information for the device with this line:
var trezorDeviceInformation = await UWPHidDevice.GetDeviceByIdSlowAsync(TrezorManager.HidId);
But, for some reason, if I try to watch for the device with product id, and vendor, Id, the watcher's events never fire. I have tried this:
public UWPHidDevice(uint vendorId, uint productId)
{
var deviceWatcher = DeviceInformation.CreateWatcher($"System.DeviceInterface.WinUsb.UsbVendorId:={vendorId} AND System.DeviceInterface.WinUsb.UsbProductId:={productId}");
deviceWatcher.Added += DeviceWatcher_Added;
deviceWatcher.Removed += DeviceWatcher_Removed;
deviceWatcher.Start();
}
and
public UWPHidDevice(uint vendorId, uint productId)
{
string aqs = UsbDevice.GetDeviceSelector(vendorId, productId);
var deviceWatcher = DeviceInformation.CreateWatcher(aqs);
deviceWatcher.Added += DeviceWatcher_Added;
deviceWatcher.Removed += DeviceWatcher_Removed;
deviceWatcher.Start();
}
The added event never fires when I plug the device in, or start the app up with the device. I must stress that I can use this device in my app, and I have triple checked the VendorId and ProductId. It's just the watcher that doesn't work. I'm stuck.
Does anyone have tips or a sample app?
Edit: I have tried the official UWP sample app. I replaced the VendorId and ProductId with the device values that I need to use in both the code, and the app manifest. The sample has the same issue.