Hi, please review and let me know, if there is a better way to create custom USB gadget.. The libusbgx library (https://github.com/linux-usb-gadgets/libusbgx) and examples were used. After compilation, there was a problem to run example. First of all, there was no usb_gadget in /sys/kernel/config folder. It appeared after calling this sequence
# to create usb_gadget folder
modprobe g_ether
# not required
rmmod g_ether
The next commands prepare libusbgx environment, as per its README file.
umount /sys/kernel/config
#this removed error in the next comand
mount -t configfs non /sys/kernel/config
After that it was possible to run libusbgx examples. In order to run more than one example, their name should be different.