无法从DeviceInformation.Id创建UsbDevice [英] Cannot create UsbDevice from DeviceInformation.Id

查看:149
本文介绍了无法从DeviceInformation.Id创建UsbDevice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用仅适用于PC的Universal Windows App(无电话)(WinRT)通过Windows.Devices.Usb API通过Windows.Devices.Usb API连接到设备(SecuGen Hamster Pro 20).

I'm trying to connect to a device (SecuGen Hamster Pro 20) through Windows.Devices.Usb APIs using Universal Windows App for PC only (no phones)(WinRT).

该设备是指纹扫描仪.

我已经完成了所有在网上找到的步骤:

I've done all the steps found online to do that:

我一直在寻找使用以下设备的所有设备:

I've looked for all devices using:

var myDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync();

这将返回大约1400个设备.经过一些过滤后使用:

This returns about 1400 devices. After some filteration using:

 var resultList = myDevices.Where(s => s.Name.ToLower().Contains("secu")).ToList<DeviceInformation>();

resultList在我的计算机上包含3个设备(我在其他计算机上尝试过,在某些计算机上发现10个结果).

resultList contains 3 devices in my machine (I've tried it on other machine and found 10 results on some).

我没有使用重载来查找设备DeviceInformation.FindAllAsync(String aqsFilter),因为它返回了0个结果,尽管我确定我做对了(使用正确的VID和PID)

I didn't use the overload for finding devices DeviceInformation.FindAllAsync(String aqsFilter) because it returns 0 results althought I'm sure I've done it right (used correct VID & PID)

这里的问题是当我尝试使用以下3种结果中的任何一种来创建UsbDevice对象时:

The problem here is when I try to create a UsbDevice object from any of the 3 results using:

UsbDevice device = await UsbDevice.FromIdAsync(resultList[0].Id);

返回值为null,我已经尝试了所有这些方法(resultList[0]resultList[1]resultList[2]),但是没有运气.

The return value is null, I've tried all of them (resultList[0] , resultList[1] , resultList[2]) with no luck.

我使用以下命令配置了功能

I configured the capabilities using:

 <DeviceCapability Name="usb">
      <Device Id="vidpid:1162 2200">
        <Function Type="name:vendorSpecific"/>
      </Device>
    </DeviceCapability> 

我还尝试使用从DeviceInformation.FindAllAsync()返回的1400个设备中的任何一个创建一个UsbDevice对象,但是所有设备都返回null,甚至有些设备抛出一个异常,提示the system cannot find the file specified 0x80070002

I also tried to create a UsbDevice object from any of the 1400 devices returned from DeviceInformation.FindAllAsync() but all returned null and even some throw an exception that says the system cannot find the file specified 0x80070002

我试图读取DeviceAccessInformation为其返回DeviceAccessStatus.Unspecified

任何人都可以把我带到这里我想念的东西吗?

Anyone can lead me to what am I missing here?

推荐答案

搜索设备时,必须使用UsbDevice.GetDeviceSelector,然后使用选择器.如果未返回任何内容,则表明该设备未正确配置"为使用WinUSB.sys驱动程序. (据我了解,它必须使用该驱动程序才能与usbdevice类一起使用).

You have to use UsbDevice.GetDeviceSelector and then use the selector when searching for the device. If that returns nothing, then the device isn't properly 'configured' to use the WinUSB.sys driver. (And from what I understand, it must use that driver to be used with the usbdevice class).

如果您手动告诉它在设备管理器中使用该驱动程序,那么从理论上讲,您仍然必须先使用regedit更改密钥(注意:我这样做了,但仍然无法使用).我在这里找到了解决方案: http://www.lewisbenge.net/2013/09/20/integrating-windows-8-1-with-owi-535-robotic-arm/ 基本上,您必须使用inf文件安装驱动程序.使用该站点上链接的那个,并根据目标平台将NTamd64替换为NTarm

If you manually told it to use that driver in the device manager, then, in theory, you still have to change a key with regedit before that works (Note: I did that and it still wouldn't work). I found a solution that solved it here: http://www.lewisbenge.net/2013/09/20/integrating-windows-8-1-with-owi-535-robotic-arm/ Basically, you have to install the driver using an inf file. use the one linked on that site and replace the NTamd64 with NTarm depending on the target platform

这篇关于无法从DeviceInformation.Id创建UsbDevice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆