https://github.com/Belcarra/gadgetconfig
We have made the above available as part of our ongoing efforts to assist developers who want to implement USB devices. This package contains tools for configuring Gadget USB Devices and integrating with systemd.
It relies on the Gadget ConfigFS module libcomposite to create and manage Gadget USB Devices.