I've looked over several of these questions for Windows and C# in general. I see some answers, where ManagementObjectSearcher is used, but as far as I know Unity doesn't have System.Management.dll by default, which is okay, because I'd rather use another way if possible (I know you can manually add it, but I'd prefer to use a different method).
This question below is similar to mine, but the answer uses System.Management and as a back-up tests every COM on the SerialPort.GetPortNames()
list. I don't like that the back-up test needs to create new SerialPorts every time to test whether a device is connected or not. It just seems inefficient to check every COM port. This is the question and answer:
How can I discover if a device is connected to a specific serial (COM) port?
On Mac/Linux, it's fairly simple to look up a device in /dev/ folder, and find the proper device for both USB and bluetooth and get the proper port name to use when creating a new SerialPort:
string[] ttys = System.IO.Directory.GetFiles("/dev/", "tty.*");
// iterate over list looking for device by name for usb and bluetooth
Is there a similar method in Windows to get a list of current devices connected to a Windows machine and their COM ports, without using System.Management or checking every single COM individually for feedback?
An ideal solution would be to lookup the devices on Windows without using System.Management.