You cannot detect this by external means. It is common practice to either establish udev rules for a particular modem manufacturer and model. Or you can connect to each tty sequentially and check with the AT command what type of port.
In the case of udev rules, you can follow this process:
1) Detecting vid and pid modem 2) Based on vid / pid, create symbolic links in / dev / serial / by -id
For example, a Sierra Wireless MC8795V modem with vid = 1199 and pid 683c. I know that port 3 is always an AT command channel. So you can create a symlink fixed with -AT at the end.
If detected using AT commands, a better and more general approach is to run the AT command to see if tty responds at all. You should receive an echo or OK if you did not configure your modem to echo.
For instance:
AT AT OK
If you get a response, it means that you found either the AT management port or the PPP port. To verify this, simply issue the ATI command. If the response contains APP1, APP2, APP3, then you get to the PPP port. Otherwise, you found your AT control port.
For example, the AT management port:
ATI Manufacturer: Sierra Wireless, Incorporated Model: MC8795V Revision: K2_0_7_46AP C:/WS/FW/K2_0_7_46AP/MSM6290/SRC 2010/10/27 22:15:30 IMEI: XXXXXXXXXXXXXXX IMEI SV: 20 FSN: D9A2160146410 3GPP Release 6 +GCAP: +CGSM,+DS,+ES OK
For example, PPP port:
ATI Sierra Wireless, Incorporated MC8795V APP1 OK
A word of warning though. In the case of Sierra Wireless modules, they clearly show which port is. For other manufacturers, you will need to check the USB manual to see if ATI can use this approach.