【发布时间】: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它被接受