2
有沒有辦法通過DeviceInformation
獲取設備的COM端口號?當我通過設備管理器查看它們時,我可以看到COM端口號。來自Windows.Devices.Enumeration.DeviceInformation的COM端口號
我剛碰到一些沒有列出COM端口號的設備作爲Name
屬性的一部分。我插入其中兩個,並且無法區分它們彼此。理想情況下,我希望看到一個COM端口。有沒有不同的方式來獲取這些信息?
string _serialSelector = SerialDevice.GetDeviceSelector();
DeviceInformationCollection tempInfo = await DeviceInformation.FindAllAsync(_serialSelector);
if (tempInfo.Count > 0)
{
foreach (var efefe in tempInfo)
{
if (efefe.Kind.Equals(DeviceInformationKind.DeviceInterface))
{
//efefe.Name
}
}
}