An article about connecting a Novacom GNS-3.5G modem to Linux. There is a need to use 3G Internet on a laptop with Slackware Linux. Available was a Novacom modem, and Windows XP on another computer. The modem comes with drivers for Windows and Mac OS, supports HSDPA / UMTS and EDGE / GPRS standards. Linux support not stated. Some forums offered to use usbmodeswitch, but this did not solve the problem completely - ports appeared, and the modem refused to work. In the article I will try to show not only the solution of this particular problem, but also the method that allows solving the problems of using AT commands (sending / receiving SMS, USSD, etc.)
Introduction
The Novacom GNS-3.5G modem, when connected, creates a block device on which the drivers are located, i.e. When first turned on, it is recognized as a flash drive. It appeared in the system as
/ dev / sg1 . To switch to modem mode, you can use either
eject or
usbmodeswitch . I chose eject
eject / dev / sg1
As a result, three ports
ttyUSB0 ,
ttyUSB1 ,
ttyUSB2 appear . On this, hints on the Internet are downloaded with the phrase: “Well, now you can use any dialer for dialing and connecting.” It is from this place that the most interesting begins. Those. ports exist, but any attempt to call causes a port reset — there is no dialing, but the ports respond to some AT commands. Re-search on the Internet does nothing. The most likely cause is a situation where the driver sends something to the ports and only then the device begins to function as a modem. It remains only to find out what this team or set of commands.
')
Study
In order to understand how the driver communicates with the modem, we will use the com-port sniffer. Virtually any sniffer that allows you to monitor a port already occupied by another device will do.
We insert the modem, launch the sniffer, launch the software that switches the device to modem mode and connects to the Internet. The result is a listing of communication software and modem. Then take the AT command and look for what it does.
Further I will give fragments of this listing with comments. Listing is shortened, the most important elements are highlighted in color
From the listing it is clear that the application works with three ports, each of which receives the
AT + CINQP command? . This command returns information about the port that is being accessed. Green indicates the response of each port. From the listing it is clear that next is communication only with the fourth port. The next important command is highlighted in red:
AT + CFUN? . This command sets the operation mode. For different manufacturers may take different values. In our case, immediately after turning on the modem, before starting work, the value
+ CFUN = 5 .
Commands are
sent to check the software number:
AT + CINQSWRV?
After that, the command to change the value
AT + CFUN = 1 is sent. Most likely, this is exactly the team that we need.
Listing served with abbreviations. The command
AT + COPS = 3,2 allows you to select the operator to connect to the 3G network. After that, the program checks if the operator is selected:
AT + COPS?
And only after that comes the initialization string:
AT + CGDCONT = 1, 'IP', 'UTEL.3G.UA'
Thus, the new sequence for initialization will look like this:
AT+CFUN=1
AT+COPS=3,2
AT+CGDCONT=1,'IP','UTEL.3G.UA'
And when you turn off the modem, you need to remember to send the command:
AT + CFUN = 5 , i.e. return it back to inactive mode.
Results
In order for Novacom GNS-3.5G to work in Linux you need:
1) Switch the device to modem mode. For example, eject / dev / sg1.
2) Add initialization strings (in this case, the UTEL operator):
AT + CFUN = 1
AT + COPS = 3.2
AT + CGDCONT = 1, 'IP', 'UTEL.3G.UA'
There are a lot of materials on the network about how to set up dialer programs, so I post only my simple script.
TIMEOUT 3
ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
"" ATZ
OK AT+CFUN=1
OK AT+COPS=3,2
OK AT+CGDCONT=1,'IP','UTEL.3G.UA'
OK ATDT*99#
CONNECT ""
A similar approach can be used to see how the modem software sends and checks SMS, USSD commands, receives data about the signal strength in the network, etc.