Hi all
There is device list in my Linux system
and Im going to set exposure to my camera sensor. I work on C/C++ application.
I can make a picture and set exposure from command this way:
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=exposure
v4l2-ctl -d /dev/v4l-subdev0 --set-ctrl exposure=512
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=analogue_gain
it uses subdevice concept.
And there is my piece of code, here I work with video0.
open(...) works ok but I can not set any parameter like exposure.
The v4l2_ioctl(...) returns errno= ENOTTY (the same errno I get with ioct(...) )
ENOTTY - Not a typewriter
char *videodevice = (char*)"/dev/video0";
v4l2_control c;
int descriptor;
descriptor = open(videodevice, O_RDWR);
if(descriptor < 0){
printf("Error Opening VideoDevice, errno=%d\n",errno);
}
c.id = V4L2_CID_EXPOSURE_ABSOLUTE;
c.value = 300;
if(v4l2_ioctl(descriptor, VIDIOC_S_CTRL, &c) == 0)
printf("V4L2_CID_EXPOSURE_ABSOLUTE: Value : %d \n",c.value);
else
printf("V4L2_CID_EXPOSURE_ABSOLUTE fail, errno=%d\n",errno);
What is wrong ? What can I check/debug ?
Solved! Go to Solution.
The control name is wrong. I had to use V4L2_CID_EXPOSURE and V4L2_CID_ANALOGUE_GAIN as a control id.
Conclusion - do not trust in examples or other working solutions, your specific code can depend on specific details differ than you see in examples
The control name is wrong. I had to use V4L2_CID_EXPOSURE and V4L2_CID_ANALOGUE_GAIN as a control id.
Conclusion - do not trust in examples or other working solutions, your specific code can depend on specific details differ than you see in examples
Hello,
Yes you can debug it, but the ENOTY error mean the frmsize structure was left initialize to 0, as side effect, the driver was reporting an invalid frmsize. Size: Stepwise 0x0 - 0x0 with step 0/0 Fix this by replicating the constraints in the raw formats too. This fixes is with software using GSteamer encodebin feature.
Regards
Thank you for your replay,
Do you mean this one structure ?
I found this as your base for answer and it is not so clear for me.
https://lkml.org/lkml/2022/12/23/380
By the way, I can get picture with gstreamer