简体   繁体   中英

How to get the processor serial number of Raspberry PI 2 with Windows IOT

我需要获取运行 Windows 10 IoT 的 Raspberry Pi2 的处理器序列号。

Usually this is within the Windows.System.Profile.HardwareIdentification namespace. Unfortunately, that's one of the unsupported namespaces with Win10 IoT Core.

Instead, to identify the metal, I'm using info from the network adaptor(s):

    public static HashSet<string> NetworkIds()
    {
        var result = new HashSet<string>();

        var networkProfiles = Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles().ToList();

        foreach (var net in networkProfiles)
        {
            result.Add(net.NetworkAdapter.NetworkAdapterId.ToString());
        }

        return result;
    }

Of course, this is not completely error proof, but, so far, the only way I can see to get a reasonably reliable device ID.

I've extracted a code sample from the Microsoft's IoT Sample (IoTCoreDefaultApp) that might helpful to you to extract device information (unfortunately, processor serial number never exposed for programming).

How to get Windows IoT device's information: 在此输入图像描述

使用此代码获取设备信息。

            Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation deviceInfo= new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();

The serial number can be found in /proc/cpuinfo

or you can use Basic Bash piping ie, cat /proc/cpuinfo | grep Serial | cut -d ':' -f 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM