Jetson Nano custom USB gadget

I am trying to implement a gadget driver on the Jetson Nano 4GB kit. I am able to create a simple Loopback gadget using configfs. However, I wanted to know if I can write a kernel module and insert it so that a custom gadget driver implementing custom functions is possible? As far as I understand, I had to enable Gadget Support in the kernel source and then enable a few functions (Loopback, Mass storage, etc.) to create a gadget using configfs. I came across a few modules in this link. However, these are inbuilt and when I try to write one similar to those in the link, I am unable to insert the module. Can someone please help?

Hello,

I am going to move this topic to the Jetson Nano category for better visibility.

Best,
Tom K

Assign those driver from “=y” to “=m” inside the tegra_defconfig.

I was able to write a gadget driver using the github repo on the same. I figured that both the codes in gadget/function and gadget/legacy is required for the gadget driver to be loaded. The code in the gadget/function can be modified to suit our needs.

Thank you!