Adding USB Gadget Support to Jibo’s Kernel while in host mode

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.

Now an arising question might be

Why do we wanna use jibo as a USB device;

Well there are some reasons , but two of the most important ones are

  1. Be able to interface without a network
  2. faster transfer speeds

While faster transfer speeds are nice, being able to interface with the shell without internet is actually really convenient & it will probably rescue softlocked robots stuck on oobe or with a broken touch screen or camera or , ofcourse a broken antenna.

So – The thing is running Uboot buildroot 2019ish. just mount the ci_hdrc USB driver and we are done right;

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.

Well what do we have access to; , surprisingly… nothing USB related

To my insane luck , we can see that this kernel 3.10.104 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… rebuild just the driver

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.

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

Now we will enable the USB drivers (you can do it through the TUI but i dont have ncurses)

PS: CONFIG_USB_CHIPIDEA should be y not mbut it still doesnt build

That is because in older C versions -fno-common became a default flag, causing multiple definitions of global variables like yylloc 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

And IT BUILDS!, but we arent done yet nonono. Now we have to build the actual standalone driver lets do that using:

make M=drivers/usb/chipidea modules
make M=drivers/usb/gadget modules

AND WE HAVE THE DRIVERS!

we will try copying them over to the robot under like a test directory ~/usb_driver_test/ , and i have to officially present to you our creation!

The digital equivalent of making a hole on the water….

Yeah apparently someone decided to stick the word -dirty on the version… AAAAAAAAAAAAAAAAAAAAAAAAAAA

So what… is it over…are you gonna recompile again

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

SO it loaded!!!!!… Or did it; <Insert Vsause song>

Well you see im stupid and i never realized g_ether and tegra-udc was already running… so i did a small test and infact it crashed the usb controller … anyway ima leave it here and continue writing if something interesting happens EOF—

BGN—

So .. we blacked out .. but SOMETHING INTERESTING HAPPENED!

i was still trying so hard i ended up just writing values to random places and at some point…. i saw the magic words!

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… anyways that enough for today – Tomorrow Troposphere is getting a huge upgrade after months and better documentation on this

Im still remaking the GITea and i also moved Troposphere here… Everything including the site is under works so pleas bare with the setup 🙂


For now … Cya and good night!

Posted in:

Leave a Reply

Your email address will not be published. Required fields are marked *