{"id":458,"date":"2026-09-23T23:23:06","date_gmt":"2026-09-23T23:23:06","guid":{"rendered":"https:\/\/kevinblog.sytes.net\/?p=458"},"modified":"2026-09-23T23:23:06","modified_gmt":"2026-09-23T23:23:06","slug":"adding-usb-gadget-support-to-jibos-kernel-while-in-host-mode","status":"publish","type":"post","link":"https:\/\/kevinblog.sytes.net\/?p=458","title":{"rendered":"Adding USB Gadget Support to Jibo&#8217;s Kernel while in host mode"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">So , up until now jibo isnt able to use the usb port to for example act as a usb device. This is mainly because of two reasons . we will talk about the second one as we go along but for starters jibo is a Tegra computer. it runs linux and it is build to utilize its usb port as a host. So if you were to plug in a keyboard . you can use it to type for example ,or plug in a thumb drive.<br><br>Now an arising question might be<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">Why do we wanna use jibo as a USB device;<\/mark><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Well there are some reasons , but two of the most important ones are <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Be able to interface without a network<\/li>\n\n\n\n<li>faster transfer speeds<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">While faster transfer speeds are nice, being able to interface with the shell without internet is actually really convenient &amp; it will probably rescue softlocked robots stuck on oobe or with a broken touch screen or camera or , ofcourse a broken antenna.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So &#8211; The thing is running Uboot buildroot 2019ish. just mount the <code>ci_hdrc<\/code> USB driver and we are done right;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1128\" height=\"64\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image.png\" alt=\"\" class=\"wp-image-459\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image.png 1128w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-758x43.png 758w\" sizes=\"auto, (max-width: 1128px) 100vw, 1128px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Well turns out Jibo doesnt have this stuff out of the box (im guessing in an effort to save space since it only has like 16Gb of storage. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well what do we have access to; , surprisingly&#8230; nothing USB related<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"284\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-1.png\" alt=\"\" class=\"wp-image-460\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-1.png 992w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-1-765x219.png 765w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To my insane luck , we can see that this kernel <code>3.10.104<\/code> has no USB gadget drivers. Without these its impossible to use the port as a gadget. So we are left with two options, Rebuild the kernel or&#8230; rebuild just the driver<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the thing i dont wanna rebuild the kernel, why; Well mainly because i dont have the device tree plus idk if there is anything special baked in that , plus honestly i dont have the will power to scout rn. So were gonna shoehorn a donor driver.<br><br>To do that we will clone the same kernel (its important that its or else it wont accept it) and  configure it for the TK1 chip<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"798\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-2.png\" alt=\"\" class=\"wp-image-461\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now we will enable the USB drivers (you can do it through the TUI but i dont have ncurses)<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"427\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-3.png\" alt=\"\" class=\"wp-image-462\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-3.png 892w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-3-767x367.png 767w\" sizes=\"auto, (max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">PS: <code>CONFIG_USB_CHIPIDEA<\/code> should be <code>y<\/code> not <code>m<\/code>but it still doesnt build<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"60\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-4.png\" alt=\"\" class=\"wp-image-463\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-4.png 771w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-4-758x59.png 758w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That is because in older C versions <code>-fno-common<\/code> became a default flag, causing multiple definitions of global variables like <code>yylloc<\/code> in legacy lexer\/parser code to fail at link time instead of being merged. SO we will mark yylloc as extern and remove builtish binaries<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"142\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-5.png\" alt=\"\" class=\"wp-image-464\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And IT BUILDS!, but we arent done yet nonono. Now we have to build the actual standalone driver lets do that using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make M=drivers\/usb\/chipidea modules\nmake M=drivers\/usb\/gadget modules<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">AND WE HAVE THE DRIVERS!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1807\" height=\"259\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-6.png\" alt=\"\" class=\"wp-image-465\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-6.png 1807w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-6-767x110.png 767w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-6-1536x220.png 1536w\" sizes=\"auto, (max-width: 1807px) 100vw, 1807px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">we will try copying them over to the robot under like a test directory <code>~\/usb_driver_test\/<\/code> , and i have to officially present to you our creation!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1465\" height=\"296\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-8.png\" alt=\"\" class=\"wp-image-467\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-8.png 1465w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-8-767x155.png 767w\" sizes=\"auto, (max-width: 1465px) 100vw, 1465px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The digital equivalent of making a hole on the water&#8230;. <br><br>Yeah apparently someone decided to stick the word <code>-dirty<\/code> on the version&#8230; AAAAAAAAAAAAAAAAAAAAAAAAAAA<br><br>So what&#8230; is it over&#8230;are you gonna recompile again<br><br>Fuck no; Since we are on linux we can just tell it it can load it anyways and its gonna believe us, and low and behold <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1465\" height=\"257\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-9.png\" alt=\"\" class=\"wp-image-468\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-9.png 1465w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-9-764x134.png 764w\" sizes=\"auto, (max-width: 1465px) 100vw, 1465px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">SO it loaded!!!!!&#8230; Or did it; &lt;Insert Vsause song><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well you see im stupid and i never realized <code>g_ether<\/code> and <code>tegra-udc<\/code> was already running&#8230; so i did a small test and infact it crashed the usb controller &#8230; anyway ima leave it here and continue writing if something interesting happens EOF&#8212;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">BGN&#8212;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So .. we blacked out .. but SOMETHING INTERESTING HAPPENED!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">i was still trying so hard i ended up just writing values to random places and at some point&#8230;. i saw the magic words!<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1440\" height=\"79\" src=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-10.png\" alt=\"\" class=\"wp-image-469\" srcset=\"https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-10.png 1440w, https:\/\/kevinblog.sytes.net\/wp-content\/uploads\/2026\/09\/image-10-766x42.png 766w\" sizes=\"auto, (max-width: 1440px) 100vw, 1440px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">IT CAN CONNECT!!!!!!!!!!!!!!!!!!!!!!!!!!!! , ofc we can also set an ip and everything. Ping is virtually Zero and this also will allow for live debugging and more&#8230; anyways that enough for today &#8211; Tomorrow <a href=\"https:\/\/kevinblog.sytes.net\/Code\/Kevin\/Troposphere\" data-type=\"link\" data-id=\"https:\/\/kevinblog.sytes.net\/Code\/Kevin\/Troposphere\">Troposphere<\/a> is getting a huge upgrade after months and better documentation on this<br><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0693e3\" class=\"has-inline-color\">Im still remaking the GITea and i also moved Troposphere here&#8230; Everything including the site is under works so pleas bare with the setup \ud83d\ude42<\/mark><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><br>For now &#8230; Cya and good night!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So , up until now jibo isnt able to use the usb port to for example act as a usb device. This is mainly because of two reasons . we will talk about the second one as we go along but for starters jibo is a Tegra computer. it runs linux and it is build [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-458","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"featured_image_src":null,"author_info":{"display_name":"kevin","author_link":"https:\/\/kevinblog.sytes.net\/?author=1"},"_links":{"self":[{"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=458"}],"version-history":[{"count":1,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions"}],"predecessor-version":[{"id":470,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions\/470"}],"wp:attachment":[{"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kevinblog.sytes.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}