microsoft / cppwinrt

C++/WinRT
MIT License
1.61k stars 232 forks source link

Bug: DeviceInformation::FindAddAsync returns empty collection when specifying a usb device. #1420

Closed Tunghohin closed 1 month ago

Tunghohin commented 1 month ago

Version

C++/WinRT v2.0.220110.5

Summary

auto devices = DeviceInformation::FindAllAsync(
    DeviceClass::VideoCapture
).get();
for (auto&& dev : devices) {
    fmt::println(stderr, L"{}", dev.Properties()
                                          .TryLookup(L"System.Devices.DeviceInstanceId")
                                          .try_as<winrt::hstring>()
                                          .value_or(L"None")
                                          .c_str());
}
fmt::println(stderr, "{}", devices.Size());

output: e094238f350befad2228bb14d8975ed

auto devices = DeviceInformation::FindAllAsync(
    UsbDevice::GetDeviceSelector(0x0603, 0x8612)
).get();
for (auto&& dev : devices) {
    fmt::println(stderr, L"{}", dev.Properties()
                                          .TryLookup(L"System.Devices.DeviceInstanceId")
                                          .try_as<winrt::hstring>()
                                          .value_or(L"None")
                                          .c_str());
}
fmt::println(stderr, "{}", devices.Size());

gets a empty collection

Reproducible example

No response

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

sylveon commented 1 month ago

This would be a Windows bug, not a cppwinrt one. Windows bugs generally go in https://github.com/microsoft/WindowsAppSDK or the Feedback Hub.