OpenPort with vin-driver and order of ports

#1

I am trying to communicate with two camera’s using two instances of the same program where I can set the port I want to connect to.

TryOpenPort code
var scannerPort = int.Parse(ScannerPortTextBox.Text);
DeviceFactory.TryOpenPort("GenICam.vin", scannerPort, out Device device)

When I first connect to port 1, then with the second instance to port 0, this works. But when I first connect to port 0, then to port 1 with the second instance it returns false (device=null).

I think there is something I’m overlooking here?

#2

Hi @Laurens

first of all I want to say sorry for the late response!

When loading the :cvb: vin driver, port 0 gets automatically loaded before it switches to the desired port.
Since opening a specific port twice isn’t possible (at least if you do it from different processes), it makes sense, that you can’t load the driver, if you already opened port 0 before. To fix this, you need to adjust the GenICam.ini file. It is located at %CVB%Drivers. Simply enable the following flag:

AutoSwitchEnable=1

All it does, is letting the driver check if the port, it currently wants to load, is already in use, and if so, it changes to the next port or as in your case: to the desired port.

Alternatively you can use the new :cvb: discovery. You will find a short tutorial on how to use it in this post: Exception during discovery

2 Likes