<?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 v4l2 does not find connected camera (VIDIOC_S_FMT) in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/v4l2-does-not-find-connected-camera-VIDIOC-S-FMT/m-p/1295991#M175837</link>
    <description>&lt;P&gt;It seems that my code does not recognize a camera detected to it (with no I2C).&lt;/P&gt;&lt;P&gt;For a project I am trying to connect a camera with a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://coral.ai/" target="_blank" rel="nofollow noopener noreferrer"&gt;Google Coral board&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;running mendel. However there is a bridge between this camera and the board which converts the camera output to MIPI. In my code I try to adjust the fmt parameters by calling VIDIOC_S_FMT here:&lt;/P&gt;&lt;PRE&gt;        CLEAR(fmt);   &lt;SPAN class="hljs-comment"&gt;// set the format of the v4l2 video&lt;/SPAN&gt;

    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;

    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (&lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt; == xioctl(fd, VIDIOC_G_FMT, &amp;amp;fmt))
            errno_exit(&lt;SPAN class="hljs-string"&gt;"VIDIOC_G_FMT"&lt;/SPAN&gt;);

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.fmt.pix.width = %d\n"&lt;/SPAN&gt;, fmt.fmt.pix.width);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.fmt.pix.pixelformat = %d\n"&lt;/SPAN&gt;, fmt.fmt.pix.pixelformat);

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"Set RGB888\r\n"&lt;/SPAN&gt;);
    fmt.fmt.pix.width       = &lt;SPAN class="hljs-number"&gt;640&lt;/SPAN&gt;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.height      = &lt;SPAN class="hljs-number"&gt;483&lt;/SPAN&gt;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.field       = V4L2_FIELD_ANY;

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt fields adjusted\n"&lt;/SPAN&gt;);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.type = %d\n"&lt;/SPAN&gt;, fmt.type);

    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (&lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt; == xioctl(fd, VIDIOC_S_FMT, &amp;amp;fmt)){
              &lt;SPAN class="hljs-keyword"&gt;switch&lt;/SPAN&gt; (errno) {
              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EAGAIN:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EAGAIN\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EINVAL:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EINVAL, fmt.type field is invalid\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EBADR:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EBADR\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EBUSY:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EBUSY\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-comment"&gt;/* fall through */&lt;/SPAN&gt;
            }
            errno_exit(&lt;SPAN class="hljs-string"&gt;"VIDIOC_S_FMT"&lt;/SPAN&gt;);
    }&lt;/PRE&gt;&lt;P&gt;However, this gives the following output with the error:&lt;/P&gt;&lt;PRE&gt;fmt.fmt.pix.width = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;
fmt.fmt.pix.pixelformat = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;
Set RGB888
fmt fields adjusted
fmt.type = &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;
VIDIOC_S_FMT error &lt;SPAN class="hljs-number"&gt;19&lt;/SPAN&gt;, No such device&lt;/PRE&gt;&lt;P&gt;Hence I think the board just does not recognize the fact that a camera is connected. If I do:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;v4l2-ctl -d0 --list-formats-ext&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I get :&lt;/P&gt;&lt;PRE&gt;ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture&lt;/PRE&gt;&lt;P&gt;Is my thinking correct? And if so, why could it be that the board does not recognize the camera?&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 08:22:02 GMT</pubDate>
    <dc:creator>DYD</dc:creator>
    <dc:date>2021-06-22T08:22:02Z</dc:date>
    <item>
      <title>v4l2 does not find connected camera (VIDIOC_S_FMT)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/v4l2-does-not-find-connected-camera-VIDIOC-S-FMT/m-p/1295991#M175837</link>
      <description>&lt;P&gt;It seems that my code does not recognize a camera detected to it (with no I2C).&lt;/P&gt;&lt;P&gt;For a project I am trying to connect a camera with a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://coral.ai/" target="_blank" rel="nofollow noopener noreferrer"&gt;Google Coral board&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;running mendel. However there is a bridge between this camera and the board which converts the camera output to MIPI. In my code I try to adjust the fmt parameters by calling VIDIOC_S_FMT here:&lt;/P&gt;&lt;PRE&gt;        CLEAR(fmt);   &lt;SPAN class="hljs-comment"&gt;// set the format of the v4l2 video&lt;/SPAN&gt;

    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;

    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (&lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt; == xioctl(fd, VIDIOC_G_FMT, &amp;amp;fmt))
            errno_exit(&lt;SPAN class="hljs-string"&gt;"VIDIOC_G_FMT"&lt;/SPAN&gt;);

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.fmt.pix.width = %d\n"&lt;/SPAN&gt;, fmt.fmt.pix.width);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.fmt.pix.pixelformat = %d\n"&lt;/SPAN&gt;, fmt.fmt.pix.pixelformat);

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"Set RGB888\r\n"&lt;/SPAN&gt;);
    fmt.fmt.pix.width       = &lt;SPAN class="hljs-number"&gt;640&lt;/SPAN&gt;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.height      = &lt;SPAN class="hljs-number"&gt;483&lt;/SPAN&gt;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;; &lt;SPAN class="hljs-comment"&gt;//replace&lt;/SPAN&gt;
    fmt.fmt.pix.field       = V4L2_FIELD_ANY;

    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt fields adjusted\n"&lt;/SPAN&gt;);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"fmt.type = %d\n"&lt;/SPAN&gt;, fmt.type);

    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (&lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt; == xioctl(fd, VIDIOC_S_FMT, &amp;amp;fmt)){
              &lt;SPAN class="hljs-keyword"&gt;switch&lt;/SPAN&gt; (errno) {
              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EAGAIN:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EAGAIN\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EINVAL:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EINVAL, fmt.type field is invalid\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EBADR:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EBADR\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-keyword"&gt;case&lt;/SPAN&gt; EBUSY:
                      &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"EBUSY\n"&lt;/SPAN&gt;);
                      &lt;SPAN class="hljs-keyword"&gt;break&lt;/SPAN&gt;;

              &lt;SPAN class="hljs-comment"&gt;/* fall through */&lt;/SPAN&gt;
            }
            errno_exit(&lt;SPAN class="hljs-string"&gt;"VIDIOC_S_FMT"&lt;/SPAN&gt;);
    }&lt;/PRE&gt;&lt;P&gt;However, this gives the following output with the error:&lt;/P&gt;&lt;PRE&gt;fmt.fmt.pix.width = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;
fmt.fmt.pix.pixelformat = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;
Set RGB888
fmt fields adjusted
fmt.type = &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;
VIDIOC_S_FMT error &lt;SPAN class="hljs-number"&gt;19&lt;/SPAN&gt;, No such device&lt;/PRE&gt;&lt;P&gt;Hence I think the board just does not recognize the fact that a camera is connected. If I do:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;v4l2-ctl -d0 --list-formats-ext&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I get :&lt;/P&gt;&lt;PRE&gt;ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture&lt;/PRE&gt;&lt;P&gt;Is my thinking correct? And if so, why could it be that the board does not recognize the camera?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 08:22:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/v4l2-does-not-find-connected-camera-VIDIOC-S-FMT/m-p/1295991#M175837</guid>
      <dc:creator>DYD</dc:creator>
      <dc:date>2021-06-22T08:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: v4l2 does not find connected camera (VIDIOC_S_FMT)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/v4l2-does-not-find-connected-camera-VIDIOC-S-FMT/m-p/1299693#M176190</link>
      <description>&lt;P&gt;Hello DYD,&lt;/P&gt;
&lt;P&gt;You can send your issue at: &lt;A href="mailto:coral-support@google.com" target="_blank"&gt;coral-support@google.com&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 12:50:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/v4l2-does-not-find-connected-camera-VIDIOC-S-FMT/m-p/1299693#M176190</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2021-06-29T12:50:48Z</dc:date>
    </item>
  </channel>
</rss>

