Linux modem how to

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.

Читайте также:  Драйвер xerox 3320 linux

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 ,

Читайте также:  What to do if linux crashes

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.

Источник

How to setup a modem with Linux

Recently, broadband internet has become so common that the use of modems has dropped dramatically. It has been many years since I had to configure a modem on a computer, let alone do so on Linux. However, modems do still have their uses. I bought a used 3COM 5610 PCI modem in order to be able to fax from Linux, and had to relearn how to configure a modem on Linux again. So, here is what I did.

Introduction

There are two types of modems, true modems, and Winmodems. Winmodems do not have the hardware circuitry that true modems have, and hence rely on the computer’s CPU doing all the work for them.

If you have a Winmodem, then it will most probably not work with Linux at all. There is no easy way to know which modems are Winmodems and which are not.

As a rule of thumb, all external serial modems should work with Linux. Internal modems can be either type.

The steps below detail what you need to do to get the modem configured with Linux. Once configured, you can use the modem to dial out, receive calls (dial-in), or as a fax.

Configuring the Modem

Getting the IRQ, I/O Port, and UART

There are several ways to determine these settings for the modem.

Читайте также:  Загрузка ядра linux в grub команда

If your modem is an external serial modem, then you probably connected it to a serial port on the back of your computer. Just do a dmesg command and watch for something like this:

ttyS01 at 0x02f8 (irq = 3) is a 16550A

If your modem is a PCI internal modem, you can either use the lspci -v command or view the contents of the /proc/pci file to determine the settings of the modem. Note down the IRQ and I/O port settings, since you will need them in a later setup.

Determining the device name

If the modem is not connecting to one of the serial ports on the back of your computer, then it is best to assign it a device name beyond the first four names. I prefer using ttyS4 for a PCI modem. Check the /dev directory to see if the devices are already there or not. If not, then you can create it using the command:

Also, create a symbolic link to the /dev/modem device, using the following command:

Using setserial

Now you need to tie the Linux device name to the settings you found in a previous step. This can be done using the setserial command:

setserial /dev/ttyS4 irq 11 port 0xc800 uart 16550

If you do not know the UART type, you can use the autoconfig parameter to setserial instead, for example:

setserial /dev/ttyS4 port 0xc800 skip_test auto_irq autoconfig

Testing the Modem

The easiest way to test the modem, is to use the minicom command. Run minicom, then enter the setup (Ctrl-A then Z then O) and use either /dev/modem or the correct /dev/ttyS? device. Save the configuration, then exit minicom and run it again. You should see some response from the modem (e.g. ATZ then OK).

Conclusion

Now the modem is configured correctly. You can now proceed to use it for dialing to the internet, or as a dial-in device, or as a fax server.

Resources

You can read more on this topic here:

Источник

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