简体   繁体   English

WINUSB 和 UWP 应用程序:无法连接到我的设备

[英]WINUSB and UWP App: Can´t connect to my Device

I'm facing two different problems with my USB device that uses WINUSB ( Class 0xFF, Subclass 0x00 )我的使用 WINUSB 的 USB 设备面临两个不同的问题(Class 0xFF, Subclass 0x00)

I have three different small apps, the UWP CustomUsbDeviceAccess from Microsoft samples modified to connect to my Custom USB Device, My UWP App i'm tryng to write, and a WPF sample program I wrote too.我有三个不同的小应用程序,来自 Microsoft 示例的 UWP CustomUsbDeviceAccess 修改为连接到我的自定义 USB 设备,我正在尝试编写的 UWP 应用程序,以及我也编写的 WPF 示例程序。 The three apps were working without problems, in my two computes, connecting to my WINUSB Custom Device, but in the middle of some windows/vs2017 upgrade, the two UWP Apps stopped working on both computers.这三个应用程序运行没有问题,在我的两台计算机上,连接到我的 WINUSB 自定义设备,但在某些 windows/vs2017 升级过程中,两个 UWP 应用程序在两台计算机上都停止工作。 The problems are different in both computers.两台电脑的问题都不一样。

The first computer, with W10 Pro Fall Creators Update.第一台带有 W10 Pro Fall Creators Update 的电脑。 The problem is, after calling this function:问题是,调用这个函数后:

this.device = await UsbDevice.FromIdAsync(devId);

it always returns null.它总是返回空值。 And if I try to run this:如果我尝试运行这个:

var deviceAccessStatus = DeviceAccessInformation.CreateFromId(devId).CurrentStatus;

it raises the excpetion它引发了异常

the system cannot find the file specified 0x80070002系统找不到指定的文件 0x80070002

The second computer, with W10 Home Insider Preview Build 17025.rs_prerelease.171020-1625, the problem here is that boths UWP App, CustomUsbDeviceAccess from Microsoft and my own UWP App, freeze entering this line:第二台电脑,W10 Home Insider Preview Build 17025.rs_prerelease.171020-1625,这里的问题是UWP App,来自微软的CustomUsbDeviceAccess和我自己的UWP App,冻结进入这一行:

var DeviceWatcher = DeviceInformation.CreateWatcher(DeviceSelector);

These codes were working, i don´t undertand what´s wrong now.这些代码正在工作,我不明白现在出了什么问题。 My USB device works in both computer with the small WPF Desktop App I wrote.我的 USB 设备在两台计算机上都可以使用我编写的小型 WPF 桌面应用程序。 I tested the same three apps with other similar USB commercial device I have in hand ( same class/subclass, winusb too), and I have the same results, so I discarded the problem is in my device or something wrong in the driver installation process.我用我手头的其他类似 USB 商业设备(同样的类/子类,winusb 也是)测试了相同的三个应用程序,我得到了相同的结果,所以我放弃了问题出在我的设备或驱动程序安装过程中的问题.

I saw another user had a similar problem in this post , but sadly, didn't find the solution.我在这篇文章中看到另一个用户有类似的问题,但遗憾的是,没有找到解决方案。

I solved the problem in the second computer: I re-installed the Windows 10 stable version ( Fall Creators ).我在第二台电脑上解决了这个问题:我重新安装了Windows 10稳定版(Fall Creators)。 In this second computer, my UWP App works and connect to my USB Device as expected.在第二台计算机中,我的 UWP 应用程序正常工作并按预期连接到我的 USB 设备。

In the first computer, my main wokstation, I think the problem is due to an error in the installation of the driver or in some permission.在第一台计算机上,我的主工作站,我认为问题是由于驱动程序安装错误或某些权限引起的。 I would like to know where my error is;我想知道我的错误在哪里; I imagine that this could be a problem in the installation in the clients that I would like to avoid我想这可能是我想避免的客户端安装中的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM