Setting controls from libargus

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;
    control.id = 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
    close(fd);
}

is this the correct way to do this?