Support Support Home » APIs » XIMEA Linux Software Package » Linux SP Knowledge Base


Linux SP Knowledge Base

Usage of API

Enumeration and Opening of cameras from multiple processes

Symptom:

Calling of xiGetNumberDevices and/or xiOpenDevice returns unexpected results when running from multiple processes.
For example - multiple applications are started in one time and each calls the xiGetNumberDevices.

Resolution:

  • Possibility 1:
    • Use only one application in one time. It can run multiple threads if needed.
  • Possibility 2
    • Use one process for enumeration (using xiGetNumberDevices and xiOpenDevice) and other processes for other tasks.
    • Ensure that only one process in time can call xiGetNumberDevices and xiOpenDevice.

Application Development

xiQ/MQ camera is not accessible after Application Crash

Symptoms:

API returns zero on call xiGetNumberDevices after camera was opened by application that crashed before while acquisition was active.

Resolution:

  • Possibility 1:
    • Disconnect and connect the camera
    • Start the application again

  • Possibility 2:
    • reload xhci_hcd driver, either using rmmod/modprobe or /sys/bus/pci/drivers/xhci_hcd/(un)bind interface (needs root privileges);

  • Possibility 3:
    • reset the USB device by execute shell command
      echo 1 > /sys/bus/usb/devices/4-2/remove
      # 4-2 is correct bus-device address for camera which can be looked up via lsusb for example
      

Trace Output Settings

In Linux, trace output is visible in error output (stderr).
For redirecting error output to a file use 2> like the following:

./xiSample 2> stderr.txt

For canceling error output (removing it) simply redirect it to the null like the following:
./xiSample 2> /dev/null/

Cancelling error output can also be done by setting the xiAPI parameter XI_PRM_DEBUG_LEVEL to the value XI_DL_DISABLED:
xiSetParamInt(0, XI_PRM_DEBUG_LEVEL, XI_DL_DISABLED);