【问题标题】:usbDeviceefaultInterfaceBulkInPipes[0] cannot find deviceusbDeviceefaultInterfaceBulkInPipes[0] 找不到设备
【发布时间】:2021-01-12 08:05:01
【问题描述】:

我正在通过 Windows.Devices.Usb 将 stm32 链接到 hololens。程序在 usbDevice.DefaultInterface.BulkInPipes[0] 处停止,但如果我运行 Microsoft Sample,它可以成功执行。我真的很困惑错误在哪里!有人可以帮忙吗?

    UInt32 vid = 0x07E4;
    UInt32 pid = 0x07E4;
    string aqs = UsbDevice.GetDeviceSelector(vid, pid);
    var device = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs);
    UsbDevice usbDevice = await UsbDevice.FromIdAsync(device[0].Id);
       
    UsbBulkInPipe bulkIn = usbDevice.DefaultInterface.BulkInPipes[0];
    DataReader reader = new DataReader(bulkIn.InputStream);  
    UInt32 bytesRead = 0;

   
    bytesRead = await reader.LoadAsync(bulkIn.EndpointDescriptor.MaxPacketSize);
    ```
<pre>
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CustomUsbDeviceAccess
</pre>

【问题讨论】:

  • 您是否将自定义DeviceCapability 添加到Package.appxmanifest 文件中
  • 非常感谢!!!!!!我成功解决了!
  • 如果答案已经解决了您的问题,请mark它被接受

标签: c# uwp usb


【解决方案1】:

usbDeviceefaultInterfaceBulkInPipes[0] 找不到设备

请检查此document,并将特定自定义DeviceCapability 添加到Package.appxmanifest 文件中

例如

<DeviceCapability Name="usb">

      <!--MUTT Device-->
      <Device Id="vidpid:045E 078E">
        <Function Type="classId:ff * *"/>
      </Device>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-19
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2020-10-06
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多