找不到usb设备iot核心

时间:2017-08-14 21:46:02

标签: vb.net raspberry-pi3 windows-10-iot-core

尝试通过USB连接到我的APC UPS并发送原始数据。

Package.appxmanifest

    <DeviceCapability Name="usb">
  <Device Id="vidpid:051D 0002">
    <Function Type="name:vendorSpecific"/>
  </Device>
</DeviceCapability>

StartupTask.vb

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Net.Http
Imports Windows.ApplicationModel.Background

' The Background Application template is documented at http://go.microsoft.com/fwlink/?LinkID=533884&clcid=0x409

Public NotInheritable Class StartupTask
    Implements IBackgroundTask

        Public Async Sub MainPage_Load(sender As Object, e As RoutedEventArgs) Handles MyBase.Loaded
    Dim VID As UInt32 = &H51D
    Dim PID As UInt32 = &H2

    Dim filter As String = Windows.Devices.Usb.UsbDevice.GetDeviceSelector(VID, PID)
    Dim dev As Windows.Devices.Enumeration.DeviceInformationCollection = Await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(filter, Nothing)
    If dev.Count > 0 Then
        Dim device As Windows.Devices.Usb.UsbDevice = Await Windows.Devices.Usb.UsbDevice.FromIdAsync(dev(0).Id)
    End If
End Sub

问题是device没有任何问题。 dev.Count1

0 个答案:

没有答案