Tool/software: Linux
We are running a custom board powered by AM335x Sitara processor and it has 2 USB ports.
USB 1 is configured in "Host" mode and is connected to an external Cellular modem.
USB0 is configured as "Peripheral" mode and is used for debug purposes.
Both these ports are using network over USB driver(RNDIS g_ether) to be detected as network interfaces.
Till now everything is working fine. Now since our product is entering production, we would like to disable the USB0 peripheral port( with a catch that the support team can enable it when required via a script/command).
I have removed the usb0 interface from the /etc/network/interfaces file, but when I plug in this particular usb port to a PC, it is still detected as a network interface due to the g_ether kernel module still enabled. I cannot afford to disable the g_ether ko as it is used by the other USB interface (HOST)(USB1) interface to talk to the cellular modem.
Is there a way I can disable the detection of this usb0(Peripheral mode) port when it is connected to any PC so that the end user doesn't get a prompt that external hardware is detected and requests any driver downloads.
Please note, that I cannot disable it via the device tree as we might need to enable it without recompiling the firmware , if there is a need to debug the product on the field.
Thanks in advance.