raspberry-pi - Windows 10 IoT - DeviceInformation.FindAllAsync() 返回空集合
问题描述
我正在尝试将 MPU-6050 (GY-521) 传感器与我的 Raspberry Pi 3 和 Windows 10 IoT 一起使用。我在 Hackster 上关注这个例子,但是下面一行
DeviceInformationCollection collection = await DeviceInformation.FindAllAsync(aqs);
返回一个空集合。我正在使用 Microsoft Lightning 提供程序。
这是aqs
通过以下方式获得的字符串值I2cDevice.GetDeviceSelector()
:
System.Devices.InterfaceClassGuid:="{A11EE3C6-8421-4202-A3E7-B91FF90188E4}" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True
解决方案
DMAP和收件箱驱动程序是相互排斥的。当通过设备门户启用 DMAP 驱动程序时,默认(收件箱)I2C 以及 SPI 和 GPIO 驱动程序被禁用。因此,您帖子中的上述代码将不起作用。请改用以下代码。
if (LightningProvider.IsLightningEnabled)
{
LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
}
I2cController controller = await I2cController.GetDefaultAsync();
推荐阅读
- python - Marshmallow:使用 load({}).data 反序列化嵌套字段
- jquery - 在 jQuery 中设置 margin-right 在 IE11 中不起作用
- python - 登录后如何运行python脚本?
- django - 在 django 响应中不显示 id
- c++ - 对 fread 的返回值感到困惑
- javascript - 迁移到 ASP.NET Core 时出现 JsonRequestBehavior 问题
- python - Python Flask App 中未捕获自定义异常
- react-native - AdMobBanner 的 `testDeviceID` 属性已弃用。测试设备 ID 现在是全局设置的。改用 AdMob.setTestDeviceIDAsync
- arrays - 查找 n 数组的所有唯一 n 组合
- reactjs - React-Table:不可分配给 Partial 类型
>