# USB Gadget ConfigFS in VOXL

Source: https://forum.modalai.com/topic/342/usb-gadget-configfs-in-voxl
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2021-07-20 06:14:13 UTC by Thomas MacNamara
Replies: 8 · Views: 1542

## Thomas MacNamara · 2021-07-20 06:14:13 UTC

I am trying to get the VOXL dev board to act as a HID device.

I am trying to use the USB gadget feature of ConfigFS.

As far as I can tell it doesn't look like the yocto build has this compiled in the Kernel.

I was just wondering if I have missed something or I should look into the VOXL Open Source Kernel Build

## Reply by modaltb (ModalAI staff) · 2021-07-20 19:45:07 UTC

Hi @Thomas-MacNamara ,

You're likely correct (not enabled).  Let me double check our flags, and also what limitations you'd hit with the open source kernel build if any (where you could modify what you needed).

## Reply by Thomas MacNamara · 2021-07-20 22:53:35 UTC

Thanks mate that would be greatly appreciated!

## Reply by modaltb (ModalAI staff) · 2021-07-23 17:06:33 UTC

Hey @Thomas-MacNamara,

Sorry for the lag, I'm new to the USB gadget, but here's some flags found on VOXL from our standard kernel, from `adb shell zcat /proc/config.gz`

```
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_DEBUG_FS=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=4
# CONFIG_USB_GADGET_XILINX is not set
# CONFIG_USB_GADGETFS is not set
# CONFIG_USB_MIDI_GADGET is not set
```

I'm guessing the actually functionality isn't there though?

## Reply by Thomas MacNamara · 2021-07-26 23:25:10 UTC (in reply to modaltb)

@modaltb I will have a look now.

## Reply by modaltb (ModalAI staff) · 2021-07-27 17:14:15 UTC

Just confirmed with a colleague that you should get the same functionality level as our 'normal' kernel.

## Reply by Thomas MacNamara · 2021-08-16 00:36:22 UTC

Sorry for the lag here, it took a while to get everything building (and we had a COVID lockdown as well (Australia (Queensland (It worked, no local covid) ) ) ) 

I have been poking around in the build scripts but to be honest this is massively out of my wheelhouse, I'm primarily a VR and Robotics developer not a Linux wizard. 

I just can't quite work out where i would need to add the flags to have GADGETFS and  the HID GADGET stuff compiled into the image.

I have tryied a few time but to be honist the whole build pipeline is systems built upon systems and the main documentation for Linux is just "use ```menuconfig``` and type ```make``` and WHABAM you get Linux"

I know this usecase is WAY outside the norm but i figured I would at least ask :)

## Reply by Eric Katzfey (ModalAI staff) · 2021-08-16 16:24:58 UTC

Yes, the build environment is quite complex. The environment is Yocto and there is a concept of "layers" that are combined to make the full build. We have our own layer in the build where we add all of these kinds of kernel flags. The layer is the project https://gitlab.com/voxl-public/system-image-build/meta-voxl. In there you will find examples in https://gitlab.com/voxl-public/system-image-build/meta-voxl/-/blob/master/recipes-kernel/linux-quic/linux-quic_git.bbappend. That file includes a bunch of cfg files from the files sub-directory that include the actual flags. You can just add your flags to any of those cfg files or create your own.

## Reply by Thomas MacNamara · 2021-08-27 06:34:10 UTC

After no small amount of playing around and Googling I think I have hit the wall.

If I set them as = y then the build won't boot when deployed through fastboot if I set them as =m then they just stay as unset
```
# CONFIG_USB_CONFIGFS is not set
# CONFIG_USB_GADGETFS is not set
``` 

I did check to see if the WIFI was running on the failed boots just incase the change was breaking ADB but it seems the build just does not like those flags.

It is so frustrating to know the hardware is there and the implementation is possible (Rasberry-pi HID is pritty dang easy).
Especially seeing as the underwater stuff is working.

The non USB solution is just to go via ethernet but that is just a lot of things being bolted on to the poor thing.

Thanks for the help though.
