How to communicate with LTE USB modem using AT commands?

How to send a sample command AT^SETPORT? and get a response from the device, in IPFire console?

Just a pointer, do not know if it is going to work. Assuming the kernel recognize the device, you need to to find the name of the device. Next you need a terminal emulator capable to communicate with the device. Traditionally, minicom would do this job with older modems attached to the serial port. Now it is the USB port, but the rest is the same.

install https://wiki.ipfire.org/addons/minicom, follow this tutorial: https://www.thegeekstuff.com/2013/05/modem-at-command/

3 Likes

Thanks a lot for the hint.
Other sources also suggest cu, socat, atinout

Below various examples:

minicom -D /dev/ttyUSB0

echo AT command | socat - /dev/ttyUSBx,crnl

echo ATI | socat - /dev/ttyUSB0,crnl

echo AT^SETPORT? | socat - /dev/ttyUSB1,crnl
 
echo "ATI;^FHVER;^SETPORT?;^SYSCFGEX?" | socat - /dev/ttyUSB1,crnl

echo AT command | atinout - /dev/ttyUSBx -

echo ATI | atinout - /dev/ttyUSB0 -

echo AT^SETPORT? | atinout - /dev/ttyUSB1 -
1 Like

@tphz I think also gnu screen should be able to establish a serial port connection and send AT commands (for the first, I am sure, for the second I am not certain but it should). Screen is available on IPFire console.

Yesterday I also came across screen prompts.
Today I did a fresh installation of core update 160, on physical hardware (not virtual).

e.q.
screen /dev/ttyUSB1

Other sources say
screen /dev/ttyUSB1 115200

Exit from screen: Ctrl+a then k next y

Example commands after screen run
ATI;^FHVER;^SETPORT?;^SYSCFGEX?

image

It also seems to be working. :smiley:

Regards
Tom

2 Likes

You can use any program communicating through the serial port.

Even you can just program in your favourite language:

sd = open serial_device
while true
     input = read standard input
     exit loop if input = stop cmd
     write input to sd
     si = read sd
     print si to standard output
close sd

All cited programs are variations of this template.
I would just suggest to use minicom. It is the standard terminal program on Linux.

5 Likes

Sorry, but unfortunately I am not a programmer :confused:

I’m looking for a simple method to send some AT commands to an E3372/E3131 modem (or other) and get a response from the device, and at the same time other IPfire users could benefit from it. :smiley:

Regards
Tom

The pseudocode was just an example. :wink:

As said, you can use each program communicating with the USB serial adapter.
And I prefer minicom, because it is the ‘standard’ in Linux.

for me it is one of the most useful things I have read in this forums, and I have read many useful things here. Very grateful for that.

1 Like