offroad Posted August 1, 2016 Report Share Posted August 1, 2016 Hi, I did a quick demo that Pipistrello boards can be uniquely identified when several are connected to the same host. The same works probably with Papilio and others, but I didn't test it. The serial number can be read e.g. with FTDI's FT_PROG utility.Alternatively, Windoze device manager, "View/devices by connection", "USB serial converter A", "Details", "Device instance path". Adapted from stackexchange. C#: using System; using System.Management; using System.Linq; using System.Text.RegularExpressions; ... your class here private static string[] matchRegexReturnString(Regex r,string s) { Match m = r.Match(s); int n = m.Groups.Count - 1; // captures start at index 1 if(n > 0) { string[] result = new string[n]; for(int ix = 0;ix < n;++ix) { result[ix] = m.Groups[ix + 1].Value; } return result; } else { return null; } } private static string getComPortName(string serialNr) { ManagementObjectSearcher searcher2 = new ManagementObjectSearcher("root\\CIMV2","SELECT * FROM Win32_PnPEntity"); Regex re1 = new Regex(@"FTDIBUS..VID_0403.PID_6010.(\d+)\D"); Regex re2 = new Regex(@"(COM\d+)"); foreach(ManagementObject queryObj in searcher2.Get()) { string p = queryObj.Path.Path.ToString(); // search for expected FTDI device string[] m = matchRegexReturnString(re1,p); if(m != null) { // search for supported serial number if(m[0] == serialNr) { string uu = queryObj["Caption"].ToString(); m = matchRegexReturnString(re2,uu); if(m != null) { return m[0]; } } } } return null; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.