linux-kernelkernel-modulemodemcdc

How to avoid modem initialization with USB gadgetfs CDC driver


I have an embedded device with the USB gadgetfs CDC_ACM driver. Especially, I do:

echo "0x0525" > idVendor
echo "0xa4a7" > idProduct
ln -s functions/acm.GS0 configs/c.1

The OS running on this embedded device is custom-made and has nothing about modem initialization. The only present executable in the inittab is:

::respawn:/sbin/getty -8 115200 ttyGS0 vt100

When I link this device to a Linux PC over a USB cable and run minicom, minicom is blocked for 30 seconds with this output:

login: ATE1 E0                                                            
Password:                                                                       
ATE1 E0                                                                         

Where does the modem initialization come from and how can I avoid it?


Solution

  • I have a similar setup. I have an embedded device with a USB CDC function enumerating at ttyACM0. When I use Minicom 2.9 on Ubuntu 24.04.2 LTS to connect to /dev/ttyACM0 I would get output like this (lightly edited to remove company info):

    _____               _____       _                                                                                            
    | __   |___ ___| |_                                                                                                           
    |    |. | | | _|  _| _|                                                                                                       
    |__|__|_| |__|_  |___|  |__|  | __||_|_       __              |        ect.org am335x-xxx-xxxttyGS0                        
                                                                                                                                  
    rag019.11 am335x-xxx-xxx                                                                                                   
    am335x-xxx-xxxATE1 E0                                                                                                      
                                                                                                                                  
                                                                                                                                  
    Login incorrect
    

    Notable are the "ATE1 E0" string and the corrupted output especially in the ASCI graphics of Arago Project. The easiest way to reproduce the behavior was causing the embedded device to reboot but keeping Minicom running. The device would reboot, ttyACM0 would reappear and then the output would follow as soon as the device began printing.

    This answer provided the solution: systemctl stop ModemManager. Now the output is clean:

     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org am335x-xxx-xxx ttyGS0
    
    Arago 2019.11 am335x-xxx-xxx ttyGS0
    

    Remember to disable the service too. When looking at the status of the service I saw error messages with timestamps corresponding to the reboots of my embedded device:

    May 29 16:19:38 xxx ModemManager[1108]: <wrn> [plugin/generic] could not grab port ttyACM0: Cannot add port 'tty/ttyACM0', unhandled port type
    May 29 16:19:38 xxx ModemManager[1108]: <wrn> [base-manager] couldn't create modem for device '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6': Failed to find primary AT port
    May 29 16:54:04 xxx ModemManager[1108]: <msg> [device /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6] creating modem with plugin 'generic' and '2' ports
    May 29 16:54:04 xxx ModemManager[1108]: <wrn> [plugin/generic] could not grab port ttyACM0: Cannot add port 'tty/ttyACM0', unhandled port type
    May 29 16:54:04 xxx ModemManager[1108]: <wrn> [base-manager] couldn't create modem for device '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6': Failed to find primary AT port