Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically connect internet via datacard with AT commands?

I have a datacard ZTE MF190. I want to use AT commands to register in 2G or 3G and access internet via datacard. Found this article about how to make data call:

AT+cgatt=1
AT+CGDCONT=1,”IP”,”epc.tmobile.com” //I used my operator PDP context
AT+CGACT=1,1

But ping from OS terminal shows 100% package loss. I've tried on Ubuntu 14 and Windows 7.

How can I connect internet with AT commands using datacard on Ubuntu?

UPDATE

I gave bounty to @tripleee's answer because it's more full than first one and answered all my questions. But I'm not satisfied with answers, so I'll answer my own question in a week.

In my answer I'll show how to handle this process with Java. So, please do not move this question to other Stack Exchange websites.

like image 220
LEQADA Avatar asked Oct 24 '15 16:10

LEQADA


2 Answers

Creating a connection between the card and your provider is not sufficient. You need some mechanism for creating a network interface out of this connection, and set up your network stack to route packets over this interface.

Traditionally, the pppd daemon has been a popular choice for this task. You would create a "chat script" with the commands for establishing a data call (these days, pppd might come packaged with a suitable canned script) and the daemon would handle the entire process of placing the call, authenticating, setting up a network interface over the circuit, and configuring the system to route packets over it, as well as configuring DNS etc to use it for resolver queries, etc.

like image 177
tripleee Avatar answered Oct 23 '22 23:10

tripleee


I tried to sniff USB port but on this case dashboard can not connect because of busy port

It is certainly possible. See this question

Found this article about how to make data call

What that article is about is how to set up the call, not how to make it. After you made correct setup, connect to internet with this command: ATD*99***1#

UPDATE1: After a bit of research I believe that article was written only to promote their software and has no practical use. In reality dialing is made with pppd or wvdial

UPDATE2: We discussed ways to solve the problem in a chat room (in Russian). It turned out cnetworkmanager will be the way to go

like image 1
Oceinic Avatar answered Oct 24 '22 00:10

Oceinic