在Windows 10 IoT / Raspberry Pi 2

时间:2016-08-26 23:09:59

标签: windowsiot windows-iot-core-10

我刚刚开始调查Lightning provider以及我尝试的第一件事 I2C ,我发现了一个问题。 I2C设备(由DeviceInformation返回)将其显示为已禁用,但使用收件箱驱动程序时显示为已启用

我有一个带有Windows 10 IoT 10.0.14393.67的RBPi2 B

我启用了DMMD Driver并创建了一个简单的程序,引用:

  • Microsoft.IoT.Lightning:1.1.0
  • Microsoft.IoT.SDKFromArduino:1.1.1

还启用了扩展程序:

  • UWP的Windows桌面扩展:10.0.14393.0
  • UWP的Windows IoT扩展:10.0.14393.0

使用

修改Package.aspxmanifest
<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"
  IgnorableNamespaces="uap mp iot">
....
  <Capabilities>
    <Capability Name="internetClient" />
    <iot:Capability Name="lowLevelDevices" />
    <DeviceCapability Name="109b86ad-f53d-4b76-aa5f-821e2ddf2141"/>
  </Capabilities>
</Package>

使用以下代码:

public MainPage()
{
    this.InitializeComponent();

    if (LightningProvider.IsLightningEnabled)
    {
        LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
    }

    CreateAsync();
}

private async Task CreateAsync()
{
    var aqs = I2cDevice.GetDeviceSelector("I2C1");

    var i2cDevices = await DeviceInformation.FindAllAsync(aqs);
    var i2cDevices_ManualAQS = await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{a11ee3c6-8421-4202-a3e7-b91ff90188e4}\" AND System.DeviceInterface.Spb.ControllerFriendlyName:=\"I2C1\"");
    var allDevices = await DeviceInformation.FindAllAsync();


    foreach (var device in allDevices)
    {
        System.Diagnostics.Debug.WriteLine($"{device.Id}  - {device.Name}");
    }
}

i2cDevices不会返回任何设备,但是i2cDevices_ManualAQS会返回1,这是禁用的(我手动更改了AQS以包含启用和禁用的设备),allDevices显示有一个I2C1其中的设备(\\?\ACPI#MSFT8000#1#{a11ee3c6-8421-4202-a3e7-b91ff90188e4}\I2C1

如果我将驱动程序更改为收件箱驱动程序 i2cDevices有1台设备且已启用。

因此,DeviceInformation正在返回不正确的数据,或者使用Lightning未启用I2C设备。

我已经将这条消息发布到了"issues"部分,但是发布在这里,以防万一我做错了,这不是一个错误。

任何想法都会受到赞赏。

谢谢!

0 个答案:

没有答案
相关问题