{"id":1840,"date":"2013-12-31T18:47:09","date_gmt":"2013-12-31T21:47:09","guid":{"rendered":"http:\/\/tangopardo.com.ar\/2cf7\/?p=1840"},"modified":"2013-12-31T18:47:09","modified_gmt":"2013-12-31T21:47:09","slug":"debugging-usb3-0-issues-when-dealing-with-usb2-0-devices","status":"publish","type":"post","link":"https:\/\/tangopardo.com.ar\/2cf7\/2013\/12\/31\/debugging-usb3-0-issues-when-dealing-with-usb2-0-devices","title":{"rendered":"Debugging USB3.0 issues when dealing with USB2.0 devices"},"content":{"rendered":"<p>Some time ago we needed to connect as many usb cameras as possible to a single computer and capture full hd video and audio. Most of our systems despite having a lot of connectors on the inside they really have one host controller and a hub.<\/p>\n<p>While the available bandwidth may be more than enough using a compressed format the amount of isochronous transfers is rather limited. Our minimal use case called for three C920 cameras. On a normal system (one host controller behind a hub) the best we could achieve was two at 1280&#215;720@30fps with audio and a third without audio, and only one at 1920&#215;1080@30fps with audio.<\/p>\n<p>So, we need to add more controllers. Usb 2.0 add-on cards are a thing of the past but luckily they were replaced with the faster USB3. Most of the usb 3 controllers also feature an usb 2.0 controller and hub for older devices but some (very rare) have a dedicated usb 2 controller for each port.<\/p>\n<p>Given this I went ahead and bought two cards of different brand and different chipset each.<\/p>\n<p>One of them had a NEC PD720200. It worked like a charm but sadly only has one usb 2 controller.<\/p>\n<p>The other sported a VIA VL800. This one has one usb 2 controller per port (this can be seen with <em>lsub -t<\/em>). That lovingly discovering didn&#8217;t last for too long as the controller crashed all the time, at best it would stop responding but sometimes it locked my system hard. The guys at Via have a very interesting definition of meeting the specs. I&#8217;ve spent a whole weekend patching kernels trying to make it behave. Now I have a quite expensive and sophisticated paperweight.<\/p>\n<h3>Testing procedures:<\/h3>\n<p>I ssh&#8217;d to the target machine and ran in several consoles:<\/p>\n<p style=\"padding-left: 30px;\">&#8211;<em> watch -n1 &#8216;dmesg | tail -n 16&#8217;<\/em> to have a log should the system crash hard.<\/p>\n<p style=\"padding-left: 30px;\">&#8211; <em>watch -n1 &#8216;grep Alloc \/sys\/kernel\/debug\/usb\/devices&#8217;<\/em> to monitor bus usage.<\/p>\n<p style=\"padding-left: 30px;\">&#8211; 3x <em>gst-launch-1.0 v4l2src device=[camera] ! queue !  ! fakesink sync=true alsasrc device=[camera soundcard] ! queue ! fakesink sync=true\u00a0<\/em>to capture from each device. video_caps is something like &#8220;image\/jpeg,width=1920,height=1080,framerate=30\/1&#8221; but I tried a couple more.<\/p>\n<p>It is really wonderful how much computing power we have nowadays. The first time I compiled a kernel it took a good four hours. On my current machine (not quite new&#8230;) it takes about forty minutes from a clean tree and around ten from an already compiled one.<\/p>\n<p><a href=\"http:\/\/tangopardo.com.ar\/2cf7\/wp-content\/uploads\/2013\/12\/debugging_usb3-0.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1844\" data-permalink=\"https:\/\/tangopardo.com.ar\/2cf7\/2013\/12\/31\/debugging-usb3-0-issues-when-dealing-with-usb2-0-devices\/debugging_usb3-0\" data-orig-file=\"https:\/\/tangopardo.com.ar\/2cf7\/wp-content\/uploads\/2013\/12\/debugging_usb3-0.png\" data-orig-size=\"1440,900\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debugging_usb3-0\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/tangopardo.com.ar\/2cf7\/wp-content\/uploads\/2013\/12\/debugging_usb3-0-300x187.png\" data-large-file=\"https:\/\/tangopardo.com.ar\/2cf7\/wp-content\/uploads\/2013\/12\/debugging_usb3-0-1024x640.png\" class=\"aligncenter size-thumbnail wp-image-1844\" alt=\"debugging_usb3-0\" src=\"http:\/\/tangopardo.com.ar\/2cf7\/wp-content\/uploads\/2013\/12\/debugging_usb3-0-150x150.png\" width=\"150\" height=\"150\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some time ago we needed to connect as many usb cameras as possible to a single computer and capture full hd video and audio. Most of our systems despite having a lot of connectors on the inside they really have one host controller and a hub. While the available bandwidth may be more than enough [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[51,24,22],"tags":[56],"class_list":["post-1840","post","type-post","status-publish","format-standard","hentry","category-opcode","category-hacks","category-software-libre","tag-tetra"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pmnbC-tG","_links":{"self":[{"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/posts\/1840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/comments?post=1840"}],"version-history":[{"count":6,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/posts\/1840\/revisions"}],"predecessor-version":[{"id":1847,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/posts\/1840\/revisions\/1847"}],"wp:attachment":[{"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/media?parent=1840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/categories?post=1840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tangopardo.com.ar\/2cf7\/wp-json\/wp\/v2\/tags?post=1840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}