- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个代码:
private async void OnDeviceAdded(DeviceWatcher watcher, DeviceInformation deviceInformation)
{
if (deviceInformation.Name.StartsWith("ClearShot") && deviceInformation.IsEnabled)
{
targetDevice = await UsbDevice.FromIdAsync(deviceInformation.Id);
OnConnected(EventArgs.Empty);
}
}
这实际上是一个从 DeviceWatcher
调用的事件问题是 targetDevice
始终为 null。
没有崩溃没有什么,它只是空的,没有改变。为什么?
编辑:这是我在 list 中的内容:
<DeviceCapability Name="usb">
<Device Id="vidpid:184c 0001">
<Function Type="classId:ff * *"/>
</Device>
</DeviceCapability>
最佳答案
为了内存,我只是注意到它在 UsbDevice.FromIdAsync 之后是空的,应该检查以下内容:
设备管理器中存在带有 WinUsb 驱动程序的设备。
在注册表中存在具有生成的 GUID 的多字符串参数 DeviceInterfaceGUIDs
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_184C&PID_0001\8000013\Device Parameters]
"DeviceInterfaceGUIDs"=hex(7):7b,00,32,00,34,00,42,00,35,00,37,00,46,00,34,00,\
37,00,2d,00,41,00,37,00,41,00,43,00,2d,00,34,00,46,00,41,00,32,00,2d,00,39,\
00,43,00,31,00,33,00,2d,00,32,00,38,00,36,00,42,00,30,00,33,00,34,00,46,00,\
Package.appxmanifest 中存在适当的 DeviceCapability
<Capabilities>
<DeviceCapability Name="usb">
<Device Id="vidpid:184C 0001">
<Function Type="classId:ff * *" />
<Function Type="name:vendorSpecific" />
</Device>
</DeviceCapability>
关于c# - UsbDevice.FromIdAsync 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39427148/
尝试连接到串行端口时,我的代码发生了一些奇怪的事情。使用 Serial Sample 时,一切正常,并且在第一次尝试时就连接了。但是,使用我的代码,串口返回一个空值。 我找到了一个变通方法,方法是在
我正在尝试将库从经典桌面移植到 UWP。除了一件事之外,一切都按计划进行。当我尝试打开与设备(Wiimote)的 HID 连接时,如果权限处于读写状态,它将无法连接。它确实适用于只读权限。 可能是什么
我有这个代码: private async void OnDeviceAdded(DeviceWatcher watcher, DeviceInformation deviceInformation)
我花了太多时间试图理解这里的问题。我正在使用 HID 条形码扫描仪,并且能够获取设备信息。但即使使用正确的设备 ID,我也无法获取 HidDevice 对象。它总是返回 null。这是我所拥有的:
这个问题在这里已经有了答案: Can I write generic extension method to run task? (1 个回答) 关闭 5 年前。 我正在使用 Unity 为全息镜头
我正在尝试创建一个类来初始化树莓派和 arduino 之间的串行连接。该类还应该能够通过已建立的串行连接进行读写。 我使用的代码来自 microsoft developers website . us
我正在尝试在 Windows 通用应用程序中使用串行端口。我一直在使用 Microsoft 的 Serial Sample 应用程序作为模板,但是我遇到了一个相当奇怪的问题。 var dis = aw
我正在尝试使用 Windows 10 SDK 中的 WiFiDirect API,并在 Win32 控制台应用程序中实现连接器方案。我已经在基本控制台应用程序和集成代码中启用了 C++/CX Micr
我正在尝试为我的手机编写一个连接到 BLE 设备的应用。 设备已配对,我编辑了 appxmanifest 以启用蓝牙功能。 但是当我运行应用程序时,下面的代码, await BluetoothLEDe
我想在 Xamarin Forms 应用程序中打开连接的蓝牙设备上的串行端口。 这是代码(我简化了它以说明问题): string l_gdsSelector = SerialDevice.GetD
我是一名优秀的程序员,十分优秀!