Getting Serial Port Information

Getting Serial Port Information

There is a post about this same issue on MSDN:

Getting more information about a serial port in C#

Hi Ravenb,

We can't get the information through the SerialPort type. I don't know why you need this info in your application. However, there's a solved thread with the same question as you. You can check out the code there, and see if it can help you.

If you have any further problem, please feel free to let me know.

Best regards,
Bruce Zhou

The link in that post goes to this one:

How to get more info about port using System.IO.Ports.SerialPort

You can probably get this info from a WMI query. Check out this tool to help you find the right code. Why would you care though? This is just a detail for a USB emulator, normal serial ports won't have this. A serial port is simply know by "COMx", nothing more.

How to get full name of Port

You need to use WMI:

var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_SerialPort");
foreach (ManagementObject result in searcher.Get())
{
// Look at result["Caption"].ToString() and result["DeviceID"].ToString()
}


Related Topics



Leave a reply



Submit