Yocto's libusbgx provide start/stop scripts to create gadgets from schema upon system start:
usbgx.service
gadget-start sh script:
/etc/default/usbgxIMPORT_SCHEMAS and imports schemas (from path /etc/usbgx/${name}.schema)/etc/usbgx.d directoryENABLED_SCHEMAS and bind UDC to gadgets:UDC_FOR_SCHEMA_${schema} is defined, then this value is used for UDC bingls /sys/class/udc/ is usedbecause ffs instances should be mounted and both descriptors and strings should be written to ep0. For more details about FunctionFS please refer to FunctionFS documentation in linux kernel repository.
Usage: gadget-export gadget_name file_name“Usage: gadget-import gadget_name file_nameUsage: gadget-vid-pid-remove vid:pid