06-15-2018 06:51 PM
We have a laptop which has connected to it a powered 4-port StarTech USB hub.
These USB ports generally show up as COM21 to COM24 but not always.
We have instruments connected to these ports that we can query.
The brute force way is to start at COM3 and go through COM30.
But is there a more efficient way of finding all the serial ports such as reading Windows registry etc?
06-15-2018 07:52 PM - edited 06-15-2018 07:53 PM
You can use Find VISA Resource to very quickly narrow down the list. You can then do some quick communication on each one to see what is connected to which port.
06-18-2018 11:01 AM
Keep in mind that if you plug that 4 port hub into a different USB port, the COM numbers may be different. I don't know if that is always the case but I've had it happen to me before.
06-18-2018 11:50 AM
@aputman wrote:
Keep in mind that if you plug that 4 port hub into a different USB port, the COM numbers may be different. I don't know if that is always the case but I've had it happen to me before.
One reason of many that I try to avoid USB instruments with automated test setups.
06-18-2018 12:31 PM
@aputman wrote:
Keep in mind that if you plug that 4 port hub into a different USB port, the COM numbers may be different. I don't know if that is always the case but I've had it happen to me before.
I have found that modern version of Windows (7+) remember the UUID of the USB device and always give the same USB device the same Com port.
06-18-2018 01:20 PM
@RTSLVU wrote:
@aputman wrote:
Keep in mind that if you plug that 4 port hub into a different USB port, the COM numbers may be different. I don't know if that is always the case but I've had it happen to me before.
I have found that modern version of Windows (7+) remember the UUID of the USB device and always give the same USB device the same Com port.
I am running Windows 7 and still run into the issue. I literally just moved a USB-Serial adapter from port 3 to port 1 on my USB hub and all of my ports were changed. So still keep that warning in the back of your mind. This is also why I say to make sure you have some way to make sure you have the right device at the port (ID querry, etc.).
06-18-2018 01:21 PM
@billko wrote:
@aputman wrote:
Keep in mind that if you plug that 4 port hub into a different USB port, the COM numbers may be different. I don't know if that is always the case but I've had it happen to me before.
One reason of many that I try to avoid USB instruments with automated test setups.
I avoid USB like the bloody plague. Unfortunately, the units I am testing use USB.
06-19-2018 05:29 AM
This problem has nothing to do with Windows 7 versus 10 versus any other OS. what I mean is that while the OS may choose to implement things differently, the underlying problem is a USB problem, not an OS problem.
Within the USB Specification, part of the device descriptor (which each device MUST have, otherwise the device won't enumerate) there is an entry for a serial number. There are no rules enforced as to the contents of this serial number. Some manufacturers are nice people and guarantee that each device they manufacture has a unique serial number so that the OS interfacing witht he device can uniquely identify it. These devices tend to retain their COM Port numbers when removing and re-adding them.
Other manufacturers like to see developers in pain and will not even bother to implement a serial number properly. When the OS sees this device, it has no way of knowing whether it's the same device as perviously or whether it's another isntance of the same type of decive and as such has absolutely no way of knowing which COM Ports to assign it.
This is the root cause of the problem. Some OSs make things even more weird by attributing the enumeration of the USB port address (which controller, which port and so on) into the unique identifier of the device. This can lead to the same device with a valid serial number to be enumerated as a completely new device if it is connected to a different port. This is an OS problem.
So if you want to minimise the headache associated with USB, make sure that the devices you are using have valid entries for the device serial number as included in the device descriptor. Here is a random like I have not tested to get the USB descriptor of your device. Linux probably has a load of really robust tools for this.
06-19-2018 05:59 AM
I made the attached .v. once I had the same issues.
Maybe You can use it.
It scans the windows registry for connected ports.
/B
06-19-2018 06:51 AM
Hi BCL,
your VI only works for your specific case…
For me I had to change the key name to "\Device\VCP0" instead of "..\Serial0". And ofcourse my VCP isn't named "Prolific"…
Btw. you should change your signature when you use LV2017 nowadays!