Набор номера at linux

Sending AT Commands

AT Commands are instructions that provide communication and control between any cellular modem and a host controller. Cellular modems can be controlled using special AT commands provided by the module manufacturer. There are several serial monitor tools that can be used to send AT commands to the cellular module. The most common is the minicom application on Linux. One can use Cutecom as GUI supported tool.

As long as the right configurations such as the device port, baud rate are selected right; any tool can be used. This tutorial will explain how to use the ATCom and Minicom tools. These tools can communicate with cellular modems on Sixfab HATs.

Before you start sending AT commands to your modem, be sure the check the port your modem is connected to as well as the baudrate. Use the built-in logs to identify the different serial ports on your system. Follow the steps below to find the name of your port(s).

Before connecting USB to your HAT, open Terminal and type the following command:

[email protected]:~ $ ls /dev/tty* /dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8 /dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9 /dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyAMA0 /dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyprintk /dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7

This should return all USB devices currently plugged into your computer. Now that we know which devices are not cellular modems, it will be easier to identify when plugged in.

[email protected]:~ $ ls /dev/tty* /dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8 /dev/ttyUSB3 /dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9 /dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyAMA0 /dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyprintk /dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyUSB0 /dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyUSB1 /dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7 /dev/ttyUSB2

Читайте также:  Завершить сессию пользователя linux

Whatever new entries appear is your cellular modem.

Alternatively, you can check dmesg:

[email protected]:~ $ dmesg | grep tty [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 smsc95xx.macaddr=DC:A6:32:49:FB:39 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=9c0c76f5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait [ 0.001546] printk: console [tty1] enabled [ 1.193107] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 29, base_baud = 0) is a PL011 rev2 [ 35.807711] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0 [ 35.808358] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1 [ 35.808916] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2 [ 35.810673] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB3

In order to, send AT commands to a cellular device, one needs to check several parameters and might need a serial monitor tool. ATCom is a command-line interface tool that makes AT command operations easier.​

Источник

How to send AT commands to a modem in Linux?

it seems to work. I type an AT and get an OK . I type some crap, I get an ERROR . It seems that modem1 for minicom is somehow configured to use the modem at /dev/ttyACM0 . How can I use socat to send AT commands? Do I need to configure something? Maybe I can use configurations for modem1 of minicom (I do not know how to find/see this configuration)?

Additional information

Is the given socat command correct? Should I play with some options? With the -v option I see the following:

AT > 2013/10/23 17:10:28.917413 length=3 from=0 to=2 AT < 2013/10/23 17:10:28.921598 length=3 from=0 to=2 AT AT ksjdhfjdgfhjkdfh >2013/10/23 17:10:30.244923 length=17 from=3 to=19 ksjdhfjdgfhjkdfh < 2013/10/23 17:10:30.251383 length=29 from=3 to=31 ksjdhfjdgfhjk\b \bd\b \bf\b \bh\b \b ksjdhfjdgfhj 
[5983726.808063] usb 2-1: USB disconnect, device number 3 [5983730.800021] usb 2-1: new full-speed USB device number 4 using uhci_hcd [5983730.920014] usb 2-1: device descriptor read/64, error -71 [5983733.629524] usb 2-1: New USB device found, idVendor=0572, idProduct=1329 [5983733.629533] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [5983733.629539] usb 2-1: Product: USB Modem [5983733.629544] usb 2-1: Manufacturer: Conexant [5983733.629549] usb 2-1: SerialNumber: 24680246 [5983733.632673] cdc_acm 2-1:1.0: ttyACM0: USB ACM device 
speed 57600 baud; line = 0; eof = ^A; min = 1; time = 0; -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -echo -echoe 

Источник

Читайте также:  Linux gui ssh client

5 Modem At Command Examples in Linux (How to Configure Minicom)

Basic commands are AT commands that do not start with “+”. Extended commands are AT commands that start with a “+”. All GSM/GPRS uses the extended commands for SMS/DATA services.

Task which can be done by using AT commands

Here are few list of tasks which can be done by using the AT commands.

  • Get basic information about the subscriber
  • Get the information about signal strength and battery strength
  • Establish a data/voice connection
  • Send and receive fax
  • Send and receive SMS
  • Read/Search phonebook entries

Note that not all modems will support all the AT commands.

In this tutorial, I’m going to show examples using my “Nokia 2700” mobile phone which has a inbuilt GSM/GPRS modem.

Installing minicom

In-order to send AT commands to modems, we need an interface. Minicom is a tool which provides an interface for communicating with devices that are connected to serial ports. Minicom is a linux equivalent to the HyperTerminal utility in Microsoft Operating Systems.

Using minicom we can send AT commands to the modem to get information about its features.

Configuring minicom to interface with the modem

Before configuring minicom, we need to connect the modem to the linux system. In my case, I’ve connected my “Nokia 2700” via data cable to my linux PC. Once the device is connected, you will see output similar to the following using dmesg. In my case the modem got detected as /dev/ttyACM0.

[ 1071.120084] cdc_acm 1-1.3:1.1: ttyACM0: USB ACM device [ 1071.120916] usbcore: registered new interface driver cdc_acm [ 1071.120917] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

To configure minicom to access modem, do the following:

# minicom -s +-----[configuration]------+ | Filenames and paths | | File transfer protocols | | Serial port setup | | Modem and dialing | | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | | Exit from Minicom | +--------------------------+

Choose the “Serial port setup” and press “Enter”. It will display a screen similar to the following.

+-----------------------------------------------------------------------+ | A - Serial Device : /dev/tty0 | | B - Lockfile Location : /var/lock | | C - Callin Program : | | D - Callout Program : | | E - Bps/Par/Bits : 115200 8N1 | | F - Hardware Flow Control : No | | G - Software Flow Control : No | | | | Change which setting? | +-----------------------------------------------------------------------+

Press ‘A’ to change the serial device from /dev/tty0 to /dev/ttyACM0.

Читайте также:  Linux get users home directory

Press ‘E’ to change the Baud rate at which the modem communicates. In my case, it is “460800”. You can also used wvdialconf to identify the baud rate supported by your modem.

Once you change these settings, press “Enter”.

Choose “Save setup as dfl” and choose “Exit”.

Now we have configured the minicom successfully and you will see a screen like the following.

Welcome to minicom 2.6.1 OPTIONS: I18n Compiled on Feb 11 2012, 18:12:55. Port /dev/ttyACM0 Press CTRL-A Z for help on special keys

To test whether we have configured minicom successfully to communicate with modem, type “AT” in the minicom. You should get a “OK” response as follows.

Welcome to minicom 2.6.1 OPTIONS: I18n Compiled on Feb 11 2012, 18:12:55. Port /dev/ttyACM0 Press CTRL-A Z for help on special keys AT OK

1. Answer an Incoming call – ATA

To answer an Incoming call via modem, issue the “ATA” command in the minicom.

When there is an incoming call, you can see a ‘RING’ message in the minicom. You can press “ATA” to answer the incoming call.

2. Dialing out and hanging up a voice call – ATD – ATH

You can also dial out a voice call from the modem using ATD command.

Now the phone will dial out to the number 99769XXXXX.

To hangup the call, use ATH command.

3. Getting the Manufacture/IMEI/IMSI information

Extended AT commands are used to provide information about the manufacturer, International Mobile Equipment Identity, International Mobile Subscriber Identity etc…

AT+CGMI Nokia OK AT+CGSN xxxxxxxxxxxxxxx OK AT+CIMI xxxxxxxxxxxxxxx OK

4. Getting Signal quality and battery charge status

You can also get the signal quality and the battery charge status using AT extended commands.

AT+CSQ +CSQ: 29,99 OK AT+CBC +CBC: 1,96 OK

The output format +CBC: 1,96 represents ,

5. Sending SMS using AT commands

You can also send SMS via AT commands.

AT+CMGF=1 OK AT+CMGS="99xxxxxxxx" > This is a test message > OK

The command AT+CMGF=1 sets the “Message format” to “text mode”. The command AT+CMGS, send the SMS to the specified number. < ctrl +z >is used to terminate the message input.

Источник

Оцените статью
Adblock
detector