<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ioctl() for dev/video0 gives ENOTTY error in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1623579#M203369</link>
    <description>&lt;P&gt;Hi all &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;BR /&gt;There is device list in my Linux system&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 877px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/216686i414313B0F0EDA2FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and Im going to set exposure to my camera sensor. I work on C/C++ application.&lt;BR /&gt;I can make a picture and set exposure from command this way:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;it uses subdevice concept.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;And there is my piece of code, here I work with video0.&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;open(...)&lt;/STRONG&gt;&amp;nbsp;works ok but I can not set any parameter like exposure.&lt;BR /&gt;The v4l2_ioctl(...) returns errno=&amp;nbsp;ENOTTY&amp;nbsp; (the same errno I get with ioct(...) )&lt;/P&gt;&lt;P&gt;ENOTTY -&amp;nbsp;&lt;SPAN&gt;Not a typewriter&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    char *videodevice = (char*)"/dev/video0";
	v4l2_control c;
	int descriptor;

	descriptor = open(videodevice, O_RDWR);
    if(descriptor &amp;lt; 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, &amp;amp;c) == 0)
		printf("V4L2_CID_EXPOSURE_ABSOLUTE:  Value : %d \n",c.value);
	else
		printf("V4L2_CID_EXPOSURE_ABSOLUTE fail,  errno=%d\n",errno);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong ? What can I check/debug ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 18:52:29 GMT</pubDate>
    <dc:creator>btarnowski</dc:creator>
    <dc:date>2023-03-28T18:52:29Z</dc:date>
    <item>
      <title>ioctl() for dev/video0 gives ENOTTY error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1623579#M203369</link>
      <description>&lt;P&gt;Hi all &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;BR /&gt;There is device list in my Linux system&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 877px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/216686i414313B0F0EDA2FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and Im going to set exposure to my camera sensor. I work on C/C++ application.&lt;BR /&gt;I can make a picture and set exposure from command this way:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;it uses subdevice concept.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;And there is my piece of code, here I work with video0.&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;open(...)&lt;/STRONG&gt;&amp;nbsp;works ok but I can not set any parameter like exposure.&lt;BR /&gt;The v4l2_ioctl(...) returns errno=&amp;nbsp;ENOTTY&amp;nbsp; (the same errno I get with ioct(...) )&lt;/P&gt;&lt;P&gt;ENOTTY -&amp;nbsp;&lt;SPAN&gt;Not a typewriter&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    char *videodevice = (char*)"/dev/video0";
	v4l2_control c;
	int descriptor;

	descriptor = open(videodevice, O_RDWR);
    if(descriptor &amp;lt; 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, &amp;amp;c) == 0)
		printf("V4L2_CID_EXPOSURE_ABSOLUTE:  Value : %d \n",c.value);
	else
		printf("V4L2_CID_EXPOSURE_ABSOLUTE fail,  errno=%d\n",errno);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong ? What can I check/debug ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 18:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1623579#M203369</guid>
      <dc:creator>btarnowski</dc:creator>
      <dc:date>2023-03-28T18:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: ioctl() for dev/video0 gives ENOTTY error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1624311#M203420</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:51:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1624311#M203420</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2023-03-29T14:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: ioctl() for dev/video0 gives ENOTTY error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1624392#M203425</link>
      <description>&lt;P&gt;Thank you for your replay,&lt;BR /&gt;Do you mean this one structure ?&lt;/P&gt;&lt;P&gt;I found this as your base for answer and it is not so clear for me.&lt;BR /&gt;&lt;A href="https://lkml.org/lkml/2022/12/23/380" target="_blank"&gt;https://lkml.org/lkml/2022/12/23/380&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;By the way, I can get picture with gstreamer&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 667px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/216892i7D201E1CC983FF13/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 16:53:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1624392#M203425</guid>
      <dc:creator>btarnowski</dc:creator>
      <dc:date>2023-03-29T16:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: ioctl() for dev/video0 gives ENOTTY error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1637125#M204516</link>
      <description>&lt;P&gt;The control name is wrong. I had to use&amp;nbsp;&lt;SPAN&gt;V4L2_CID_EXPOSURE and&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;V4L2_CID_ANALOGUE_GAIN as a control id.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Conclusion - do not trust in examples or other working solutions, your specific code can depend on specific details differ than you see in examples&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 09:51:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/ioctl-for-dev-video0-gives-ENOTTY-error/m-p/1637125#M204516</guid>
      <dc:creator>btarnowski</dc:creator>
      <dc:date>2023-04-20T09:51:52Z</dc:date>
    </item>
  </channel>
</rss>

