V4L2 wrapper pakages are not working for AP1302 driver

Hi Team,

I have written v4l2 driver for AP1302. I am able to control V4l2 parameters with cmds.

v4l2-ctl -d /dev/v4l-subdev4 -L

User Controls

                 brightness 0x00980900 (int)    : min=0 max=65535 step=256 default=0 value=0
                   contrast 0x00980901 (int)    : min=0 max=65535 step=256 default=0 value=0
                 saturation 0x00980902 (int)    : min=0 max=65535 step=256 default=4096 value=4096
         white_balance_mode 0x0098090c (menu)   : min=0 max=1 default=1 value=1
			0: Manual Temp Mode
			1: Auto Mode
                      gamma 0x00980910 (int)    : min=0 max=65535 step=256 default=0 value=0
                   exposure 0x00980911 (int)    : min=0 max=1000000 step=1 default=10000 value=10000
                       gain 0x00980913 (int)    : min=0 max=65535 step=256 default=256 value=256
                      hflip 0x00980914 (bool)   : default=0 value=0
                      vflip 0x00980915 (bool)   : default=0 value=0
  white_balance_temperature 0x0098091a (int)    : min=2300 max=15000 step=1 default=5000 value=5000
                  sharpness 0x0098091b (int)    : min=0 max=65535 step=256 default=0 value=0
     backlight_compensation 0x0098091c (int)    : min=0 max=65535 step=256 default=256 value=256
             special_effect 0x0098091f (menu)   : min=0 max=4 default=0 value=0
			0: Normal Mode
			1: Black and White Mode
			2: Grayscale Mode
			3: Negative Mode
			4: Sketch Mode

Camera Controls

              exposure_mode 0x009a0901 (menu)   : min=0 max=1 default=1 value=1
			0: Manual Mode
			1: Auto Mode
                 pan_target 0x009a0908 (int)    : min=0 max=256 step=1 default=128 value=128
                tilt_target 0x009a0909 (int)    : min=0 max=256 step=1 default=128 value=128
                zoom_target 0x009a090d (int)    : min=256 max=2048 step=1 default=256 value=256
                 scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0
			0: None
			1: Backlight
			2: Beach/Snow
			3: Candle Light
			6: Fireworks
			7: Landscape
			8: Night
			9: Party/Indoor
			10: Portrait
			11: Sports
			12: Sunset
			13: Text
                 group_hold 0x009a2003 (bool)   : default=0 value=0 flags=execute-on-write
                sensor_mode 0x009a2008 (int64)  : min=0 max=4 step=1 default=0 value=0 flags=slider
                 frame_rate 0x009a200b (int64)  : min=2000000 max=30000000 step=1 default=30000000 value=2000000 flags=slider

I am able to change it cmd but with API it is giving me error 22.
I am using sample API /usr/src/jetson_multimedia_api/samples/12_v4l2_camera_cuda/camera_v4l2_cuda.cpp and added following function.

static bool
struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl;
ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(V4L2_CID_GAIN);
ctrls.count = 1;
ctrls.controls = &ctrl;

memset(&ctrl, 0, sizeof(ctrl));
ctrl.id = V4L2_CID_GAIN;

if (ioctl(ctx->cam_fd, VIDIOC_G_EXT_CTRLS, &ctrls) < 0)
     ERROR_RETURN("Failed to dequeue camera buff: %s (%d)",
     strerror(errno), errno);

return 1;

But after this I am getting ERROR: control_v4l2(): (line:576) Failed to dequeue camera buff: Invalid argument (22)

I have taken reference of topic Failed to configure sensor_mode by using v4l2 API

Thank you,

Suppose it’s USB camera.
If yes then need to confirm the CID class.


No its not USB camera. I am working on AR0234(CSI camera).

I would suggest checking the source code of v4l2-ctl to figure it out.


Can you please give me the link to v4l2-ctrl source code?

Check this.


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