Linux – How to send AT commands to modem once the connection is established

linuxmodemnetworkingpppserial port

I have a zte 3g modem. I use carrier provided dialer for connection establishment. Once the ppp connection is active, i would like to send some AT commands(for ex. Query signal strength, AT+CSQ). But the dialer i use locks the /dev/ttyUSB0 port, which is the command port to send AT commands for my modem. So is there any way, to send the commands, once the connection is active?


Edit: I also tried the additional port /dev/ttyUSB1. But the port is flowing with random data from the modem. A sample is given below.

T^PREFMODE??                                                                    
^PREFMODE:8                                                                     

OK                                                                              
TC                                                                              
^DSDORMANT:1                                                                    

+CSQ:19, 99                                                                     

OK                                                                              
T^SYSINFO                                                                       
^SYSINFO:2,3,0,4,255                                                            

OK                                                                              
TT^SYSINFO?                                                                     
^SYSINFO:2,3,0,4,255  

I tried adding my commands, i even got output. But the response is very poor. Most of the times, my AT commands went unnoticed.

Best Answer

As long as the device is used for ppp traffic, it is not possible to run AT commands at the same time1. For this reason all modern modems will provide more than one serial interfaces, e.g. /dev/ttyUSB0 and /dev/ttyUSB1 (or /dev/ttyACM0 and /dev/ttyACM1 for USB CDC modems on linux).

Back in the days when phones had RS-232 compatible connectors (perhaps with additional IrDA), 3GPP standardized a multiplexing protocol as 07.10 to overcome the physical limitation, although that required special drivers on the PC so it never took off. Today with USB's inherent multiplexing capabilities, there are no excuses for not providing multiple serial interfaces (usually there are only two though).

So as already mentioned in a comment, you should use the other serial device, e.g. /dev/ttyUSB1.


1 In theory it might be possible for the modem to support +++ escaping which would then allow you to run AT commands while the connection was ongoing, although then you would have to in some way modify the dialer program to inject those and extract the response...

Related Question