Setting controls from libargus

Hi! We are currently working on a application based on argus to control stereo cameras that are synchronized through an external trigger signal. The trigger mode of the cameras can be set by running:
v4l2-ctl -d <device> -c trigger_mode=1
Is there a possibility to set this directly via argus? This seems to be something that ISourceSettings should be extended for, but I’m not sure how I would go on about this.

Any help?

hello r.deibel,

there’s sample application for your reference,
this is Argus based sample application to demonstrate the functionality of stereo cameras.
for instance, /usr/src/jetson_multimedia_api/argus/samples/syncStereo

this sample app uses frame sync detection based-on TSC timestamp received from driver.
it also has an option (i.e. sessionSyncExternal) for syncPulse.

Hi Jerry,

thanks for the answer. Getting stereo images is not really the issue. We already implemented stereo imaging with an external trigger. What I’m trying to solve is setting the control trigger_mode of our sensor.

I can do this with v4l2-ctl but would like to do it on demand through our application. This may not be Argus related but when I try to open the devices with the calls to v4l2_open I’m receiving error messages from deeper in the stack. I can post those and the code if you are interested. I think there should be a way to set those controls, what would the correct way be?

Also I do not have the version of syncStereo that supports the sessionSyncExternal feature.

Our jetpack version is: 5.1.1


I solved my issue with the following:

#include <stdexcept>
#include <string>

#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <unistd.h>

void setDeviceControl(uint8_t deviceIndex, TriggerModeControl controlId) {
    // build device file accessor from index
    // device files are stored as /dev/videoX
    auto deviceFile {std::string("/dev/video" + std::to_string(deviceIndex))};
    auto fd {open(deviceFile.c_str(), O_RDWR)};
    // holds access to v4l device controls
    v4l2_control control; = controlId;
    control.value = TriggerMode::EXTERNAL;
    // set via ioctl request
    if (ioctl(fd, VIDIOC_S_CTRL, &control) < 0) {
        throw std::runtime_error(
            "Setting trigger mode to " + std::to_string(deviceIndex) + " for " + deviceFile + " failed"
    // the set trigger mode should be persistant

is this the correct way to do this?

ya, the code snippet in comment #5 it looks okay.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.