<?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 Re: Imx6 as UVC wbcam camera in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1639891#M204806</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/203078"&gt;@Kanstantsin1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the additional information. I just noticed you are using a&amp;nbsp; quite new kernel, so there is something we can try out at least for testing purposes and find out what is going on &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;The kernel version you are using has added the scatter-gather (SG) support to UVC, this is quite a new addition to the UVC driver. However, SG is quite picky with the memory alignment and memory type you pass to the driver and it can easily complain about it. So let's first give it a try to the legacy memory transfer support (slower than SG) to check everything is working. There might be better ways to do it but since we are just testing, we can disable the SG support with the following patch in uvc_queue.c:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;@@ -135,12 +135,7 @@ int uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2&lt;/SPAN&gt;
 	queue-&amp;gt;queue.buf_struct_size = sizeof(struct uvc_buffer);
 	queue-&amp;gt;queue.ops = &amp;amp;uvc_queue_qops;
 	queue-&amp;gt;queue.lock = lock;
&lt;SPAN class=""&gt;-	if (cdev-&amp;gt;gadget-&amp;gt;sg_supported) {&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_dma_sg_memops;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;use_sg = 1;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-	} else {&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_vmalloc_memops;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-	}&lt;/SPAN&gt;
&lt;SPAN class=""&gt;+	queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_vmalloc_memops;&lt;/SPAN&gt;
 
 	queue-&amp;gt;queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY
 				     | V4L2_BUF_FLAG_TSTAMP_SRC_EOF;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ridgerun.com" target="_blank" rel="noopener"&gt;www.ridgerun.com&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2023 15:24:49 GMT</pubDate>
    <dc:creator>marcomadrigal</dc:creator>
    <dc:date>2023-04-25T15:24:49Z</dc:date>
    <item>
      <title>Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1637530#M204547</link>
      <description>&lt;P&gt;Hi there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found the article :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.ridgerun.com/wiki/index.php/How_to_use_the_UVC_gadget_driver_in_Linux" target="_blank"&gt;https://developer.ridgerun.com/wiki/index.php/How_to_use_the_UVC_gadget_driver_in_Linux&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And tried the second way to send video to PC through function uvc and the software:&amp;nbsp;&lt;A href="https://gitlab.freedesktop.org/camera/uvc-gadget" target="_blank"&gt;https://gitlab.freedesktop.org/camera/uvc-gadget&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So device is detected as camera. But it doesn't send picture. At kernel log I see:&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;STRONG&gt;[ 78.763930] configfs-gadget gadget: uvc: Failed to queue request (-22).&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[ 79.259922] ci_hdrc ci_hdrc.0: not page aligned sg buffer&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[ 79.265343] configfs-gadget gadget: uvc: Failed to queue request (-22).&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[ 79.776011] ci_hdrc ci_hdrc.0: not page aligned sg buffer&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[ 79.781435] configfs-gadget gadget: uvc: Failed to queue request (-22).&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[ 80.277839] ci_hdrc ci_hdrc.0: not page aligned sg buffer&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Does anyone can help me?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 21:25:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1637530#M204547</guid>
      <dc:creator>Kanstantsin1</dc:creator>
      <dc:date>2023-04-20T21:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1637535#M204548</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/4324"&gt;@marcomadrigal&lt;/a&gt;&amp;nbsp;Hi. Have you seen such problem?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 21:29:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1637535#M204548</guid>
      <dc:creator>Kanstantsin1</dc:creator>
      <dc:date>2023-04-20T21:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638114#M204611</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Unfortunately I&amp;nbsp; haven't seen that error, however, we have not used that library either. I would recommend to first give it a try to this project:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/wlhe/uvc-gadget" target="_blank" rel="noopener"&gt;https://github.com/wlhe/uvc-gadget&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will notice it is much less complex, and yet it is functional. Since it is less complex it will be less error prone and you might have better chances to test functionality before moving to a more complex solution.&lt;/P&gt;&lt;P&gt;I am not yet suggesting any solution, but a way to get a better sense of what is going on.&lt;/P&gt;&lt;P&gt;Another hint would be to enable the host-side debug and check if you get any hints of what is going on:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sudo echo 0xffff &amp;gt; /sys/module/uvcvideo/parameters/trace&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, make sure the format and resolutions you are trying to capture match with the ones registered by the device, you can check the device's reported formats with&lt;/P&gt;&lt;PRE&gt;lsusb -v -d &amp;lt;PID&amp;gt;:&amp;lt;VID&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ridgerun.com" target="_blank" rel="noopener"&gt;www.ridgerun.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 14:54:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638114#M204611</guid>
      <dc:creator>marcomadrigal</dc:creator>
      <dc:date>2023-04-21T14:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638117#M204612</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I think someone at&amp;nbsp;@RidgeRun&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 14:30:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638117#M204612</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2023-04-21T14:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638947#M204707</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;A href="https://community.nxp.com/t5/user/viewprofilepage/user-id/4324" target="_blank"&gt;@marcomadrigal&lt;/A&gt;&lt;BR /&gt;Thank you for your reply.&amp;nbsp; Unfortunately, it seems to me problem lays at another way.&amp;nbsp;&lt;BR /&gt;But let's me describe what I know now.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Yeah.&amp;nbsp;&lt;A href="https://github.com/wlhe/uvc-gadget" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/wlhe/uvc-gadget&lt;/A&gt;. This application is simpler, but produces the same dmesg log (as I listed at topic).&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&amp;nbsp;echo 0xffff &amp;gt; /sys/module/usb_f_uvc/parameters/trace - doesn't&amp;nbsp; show any interesting. (BTW: I have&amp;nbsp;usb_f_uvc, but not&amp;nbsp;uvcvideo. Can the problem lay here?).&lt;BR /&gt;&lt;BR /&gt;So I was digging around the problem and found that it is stumbled at the line:&lt;/P&gt;&lt;P&gt;&lt;A href="https://elixir.bootlin.com/linux/v5.15.32/source/drivers/usb/chipidea/udc.c#L518" target="_blank"&gt;https://elixir.bootlin.com/linux/v5.15.32/source/drivers/usb/chipidea/udc.c#L518&lt;/A&gt;&lt;BR /&gt;It is checking for memory alignment. So memory can be mmaped but not&amp;nbsp; aligned....&amp;nbsp; It is strange.&amp;nbsp; I haven't found such checking(on aligment) at dw3&lt;/P&gt;&lt;P&gt;So I have quesetion.&lt;/P&gt;&lt;P&gt;It is something wrong with chipidea driver or may be my configuration spoiled so the request is not aligned?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 12:29:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1638947#M204707</guid>
      <dc:creator>Kanstantsin1</dc:creator>
      <dc:date>2023-04-24T12:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1639891#M204806</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/203078"&gt;@Kanstantsin1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the additional information. I just noticed you are using a&amp;nbsp; quite new kernel, so there is something we can try out at least for testing purposes and find out what is going on &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;The kernel version you are using has added the scatter-gather (SG) support to UVC, this is quite a new addition to the UVC driver. However, SG is quite picky with the memory alignment and memory type you pass to the driver and it can easily complain about it. So let's first give it a try to the legacy memory transfer support (slower than SG) to check everything is working. There might be better ways to do it but since we are just testing, we can disable the SG support with the following patch in uvc_queue.c:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;@@ -135,12 +135,7 @@ int uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2&lt;/SPAN&gt;
 	queue-&amp;gt;queue.buf_struct_size = sizeof(struct uvc_buffer);
 	queue-&amp;gt;queue.ops = &amp;amp;uvc_queue_qops;
 	queue-&amp;gt;queue.lock = lock;
&lt;SPAN class=""&gt;-	if (cdev-&amp;gt;gadget-&amp;gt;sg_supported) {&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_dma_sg_memops;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;use_sg = 1;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-	} else {&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-		queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_vmalloc_memops;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;-	}&lt;/SPAN&gt;
&lt;SPAN class=""&gt;+	queue-&amp;gt;queue.mem_ops = &amp;amp;vb2_vmalloc_memops;&lt;/SPAN&gt;
 
 	queue-&amp;gt;queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY
 				     | V4L2_BUF_FLAG_TSTAMP_SRC_EOF;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ridgerun.com" target="_blank" rel="noopener"&gt;www.ridgerun.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 15:24:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1639891#M204806</guid>
      <dc:creator>marcomadrigal</dc:creator>
      <dc:date>2023-04-25T15:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Imx6 as UVC wbcam camera</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1640440#M204856</link>
      <description>&lt;P&gt;Thank you a lot,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/4324"&gt;@marcomadrigal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;It works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 09:40:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Imx6-as-UVC-wbcam-camera/m-p/1640440#M204856</guid>
      <dc:creator>Kanstantsin1</dc:creator>
      <dc:date>2023-04-26T09:40:53Z</dc:date>
    </item>
  </channel>
</rss>

