I have successfully configured USB On-The-Go (OTG) on an STM32 MPU (Linux) to support both Abstract Control Model (ACM) and Human Interface Device (HID) protocols. I utilized the stm32_usbotg_eth_config.sh script as a reference, and the setup is functioning as intended.
Now, I am seeking guidance on modifying the USB configuration to initially support only the HID protocol. Subsequently, I aim to dynamically enable the ACM protocol when specific events occur. To achieve this, I have adapted the script to exclusively open the HID protocol and created another script to open the ACM protocol as well.
While the second script is functional, I have observed that in order to detect the ACM functionality on my Windows computer, I need to disable the gadget via echo "" > UDC and then re-enable it via echo $(ls -1 /sys/class/udc/ > UDC) as per the kernel reference.
Is there a method to append an additional function without the need to disable and enable the UDC, or alternatively, is there a way to activate or deactivate functions dynamically while the USB gadget is still operational?
I wrote another script to open the ACM and it wouldn't open the COM on the Windows machine without disable and enable the gadget. Reference https://docs.kernel.org/usb/gadget_configfs.html.