How does Arduino IDE 'Get Board Info'?
Looking at the source code of the Arduino IDE on github, it looks like they call an executable (listComPorts.exe). So I would guess you can't get that info through serial.
Here's a C# app using WMI that can get port, vid, and pid:
namespace PortTest
{
class Program
{
// Helper function to handle regex search
static string regex(string pattern, string text)
{
Regex re = new Regex(pattern);
Match m = re.Match(text);
if (m.Success)
{
return m.Value;
}
else
{
return null;
}
}
static void Main(string[] args)
{
// Use WMI to get info
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_PnPEntity WHERE ClassGuid=\"{4d36e978-e325-11ce-bfc1-08002be10318}\"");
// Search all serial ports
foreach (ManagementObject queryObj in searcher.Get())
{
// Parse the data
if (null != queryObj["Name"])
{
Console.WriteLine("Port = " + regex(@"(\(COM\d+\))", queryObj["Name"].ToString()));
}
//PNPDeviceID = USB\VID_1A86&PID_7523\5&1A63D808&0&2
if (null != queryObj["PNPDeviceID"])
{
Console.WriteLine("VID = " + regex("VID_([0-9a-fA-F]+)", queryObj["PNPDeviceID"].ToString()));
Console.WriteLine("PID = " + regex("PID_([0-9a-fA-F]+)", queryObj["PNPDeviceID"].ToString()));
}
}
Console.WriteLine("Done");
int c = Console.Read();
}
}
}
From there, it looks like it searches an online database for more info. See: getBoardWithMatchingVidPidFromCloud()
function.