#Mac os x serial port emulator how to
What I would like to know is how to get the event to tell me whether it is a type 2 or a type 3. If I set it to =2 (device arrival) or =3 (device removal) I can have the message only returned if the query parameter is met. There is a Event Query Condition called EventType. I downloaded the WMICodeCreator and found that if I set namespace to root\CIMV2 and select Win32_DeviceChangeEvent as the Event class I can get an event message when I plug or unplug the serial port adaptor.
OK, I am starting to make some progress, but I still have questions. You can get a notification from WMI when Plug & Play devices are added, check this thread. Try using the SerialPort.GetPortNames() method to find out which ports are available. Port = new SerialPort(sPortName, 9600, Parity.None, 8, StopBits.One) String portNames = SerialPort.GetPortNames() If that's the case, then looking for the Vid and Pid won't work. I have a feeling I will be told, however, that the device I'm looking for can be a different model than the one I'm using. For anyone that thinks they can use this code, just be aware that I'm not sure this is what I'll end up using. I *believe* I am correct in thinking that the Vid and Pid should always be the same as long as the same device is being used. Instead of looking for "Prolific" though, the code looks for the USB Vid and Pid of the device.
Well, using the tool you supplied I was able to find a class I could use to query to get the info I need.