Setting Jetson Nano shutter and gain from C/C++ program


We use C/C++ programs to get frames from sensors, connected to Jetson Nano (L4T 32.3.1).
The V4L drivers are non-Nvidia. The code is based on examples from v4l-utils package.
All operations seem to work OK with one exception: we can’t set/get shutter and gain.
Here is an example of our code:

#include <linux/videodev2.h>
#include "tegra-v4l2-camera.h"

int  fd = ...;    // handle of opened video device

static int xioctl(int fh, unsigned long int request, void *arg)
    int r;

    do {
        r = ioctl(fh, request, arg);
    } while (-1 == r && EINTR == errno);

    return r;

int our_code(void)
    struct v4l2_control  ctl;

    memset(&ctl, 0, sizeof(ctl)); = TEGRA_CAMERA_CID_EXPOSURE;
    ctl.value = 10000;

    rc = xioctl(fd, VIDIOC_S_CTRL, &ctl);
      printf("%s(): xioctl(): VIDIOC_S_CTRL error=%d\n", __func__, rc);
      printf("%s(): xioctl(): OK\n", __func__);

    return rc;

The function our_code() returns always -1.
We remember that in earlier versions of L4T this code worked.

Thank you in advance.

I check with below command without problem.
Could you confirm and check the v4l-utils to figure the root cause.

v4l2-ctl --set-ctrl=gain=32
v4l2-ctl --get-ctrl=gain