using wvdial or NetworkManager while connecting on a USB 3g phone modem in India (on the Reliance GSM 3g network)

Ron Leach ronleach at tesco.net
Tue Mar 8 11:43:40 UTC 2016


On 07/03/2016 23:07, Ranjan Maitra wrote:
> While using NetworkManager, the modem is detected and there pops the usual "MobileBroadband connection made which even identifies correctly the provider", but nothing actually happens (and this connection can not be edited). So I create a new Mobile Broadband connection and put in the usual entries: APN: smartnet, plan Reliance but it does not even go to connect. NetworkManager refuses connetion almost instantly and that is that. I have tried changing the phone number from the default *99# to *99***1# and even #700 though I am not sure if the latter is for CDMA connections. Either way, it made no difference so I decided to try the wvdial route.
>

I think there are 2 different ways to use a 3G phone with Linux over USB.

One way is as a sort of 'Ethernet' over USB, where the phone is 
treated as an automatic, 'self-deciding', device which attaches to the 
3G network, and establishes its own data service (using 2G, 3G, HSPA, 
4G, whatever network it can find and register on).  Then, the phone 
will ALSO be happy to 'share' its own network connection, over USB, to 
and for any attached computer.  In this case, the computer does not 
control the phone, and the USB interface is just a 480kbps connection 
to an Ethernet transmission device to the internet (happens to be a 
mobile phone), just like an ADSL modem behaves in a wired telephony 
example.

In that case, the phone must be set up to 'share' its interconnection 
across the USB interface.  I do not know whether that has to be set up 
by you on the phone, or whether the phone just does it anyway; a look 
through the menus might reveal something.

Note that in this case Network Manager should (and, presumably, does) 
make no attempt to control the phone, but should allow the Fedora user 
to set whether either (a) the USB interface receives an IP address 
from the phone (ie, a DHCP arrangement with the phone as the gateway 
router), or (b) the USB interface is given a static IP of your own 
choice but, in which case, you will need to set the 'gateway' to the 
IP address of the phone, and you will need to set DNS server addresses 
to some servers that are reachable across that USB interface to the 
phone.  For initial testing purposes, it might be simpler to allow NM 
to use a DHCP connection on that interface.

I have sometimes seen a driver 'cdc_ether' in the logs but I am not 
sure whether 'cdc_ether' should be present when this mode is operating.

Summarising, in this arrangement, the phone is a gateway router, 
attaching to the internet on its own (not under the control of the 
Fedora system), and the Fedora system is set to use that device as its 
internet gateway.


The second way that an internet connection can be provided through a 
mobile phone is by using the phone (solely) as a modem.  This is a 
sort of 'DUN' arrangement, as you know.  I have used wvdial to do this 
- but not recently and not on an Android phone.  If the phone is, 
truly, standards-compliant, then it should be possible because it 
should honour the relevant AT commands.  I would expect it to do so.

In this second arrangement the Fedora system should be set up much as 
you have it.  The phone needs to be set up very slightly differently. 
  The phone must not be set so as to allow itself to connect to the 
Internet.  On my (earlier than your) Android phone, I can prevent this 
by turning 'off' its data service.  Then, the phone's data service 
will be inactive, until the relevant AT command is received from 
Fedora, when it will attempt the connection.  In this way, wvdial can 
control the connection, and the disconnection.  I would expect that if 
the phone is controlling its own connection, it will likely get 
muddled with, or ignore, any AT commands from the Fedora system.

> [76131.955764] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
>

This looks good.

>
> So, I created a /etc/wvdial.conf:
>
> [Dialer LG]
> Init2 = ATZ
> Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
> Stupid Mode = 1
> Modem Type = USB Modem
> ISDN = 0
> Phone = *99***1#
> Init5 = AT+CGDCONT=1,"IP","smartnet";
> Modem = /dev/ttyACM0
> Username = reliance
> Dial Command = ATDT
> Password = gsm
> Baud = 460800
>

Perhaps OK.  I'm slightly nervous about setting the GPRS context 
separately from another subsequent command with a dial string - just 
in case, for some reason, the action of 'dialling' triggers the use of 
another, 'different' context - perhaps one embedded elsewhere in the 
phone, or in Fedora (an earlier attempt, for example).  But it may be 
OK.  It's been a while since I did this, but I am cautious about any 
setup that is not explicit, and relies on anything 'implicit'.

> I am told that the user name and the password are not important for GSM connections as long as something is present because that is all GSM checks for.

That's often the case, it seems, but I would set them to whatever 
Reliance expects to see.  There is normally some guidance with this on 
the provider's help pages.  But I don't think that's your problem 
(yet); I don't think you've managed to get that far.

>
> I then run sudo wvdialconf /etc/wvdial.conf  and get the following:
> [...]
> ttyACM0<*1>: Speed 460800: AT -- OK
> ttyACM0<*1>: Max speed is 460800; that should be safe.
> ttyACM0<*1>: ATQ0 V1 E1 S0=0&C1&D2 +FCLASS=0 -- OK
>
> Found an USB modem on /dev/ttyACM0.
> Modem configuration written to /etc/wvdial.conf.
> ttyACM0<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0&C1&D2 +FCLASS=0"

OK

> So, it looks like all are on the correct track: so let me try
>
> $ sudo wvdial LG
> -->  WvDial: Internet dialer version 1.61
> -->  Initializing modem.
> -->  Sending: ATZ
> ATZ
> -->  Sending: ATQ0

No.  Why has there not been an 'OK' from the ATZ?

> ATQ0
> OK

Well that looks acceptable but, I wonder if perhaps the 'OK' is the 
'OK' from the ATZ?

> -->  Re-Sending: ATZ
> ATZ
> OK

Again, is this the OK from the ATQ0?

> -->  Sending: ATZ

But no 'OK'

> -->  Sending: ATQ0
> ATQ0

No 'OK'

> -->  Re-Sending: ATZ
> ATZ

no 'OK'

> -->  Modem not responding.

Presumably a second or so later, when some timeout expires.
>
>
> I am not able to get out of this despite several edits to the /etc/wvdial.conf files. Any suggestions as to what is going wrong as well as what I should be looking at?
>

Using wvdial in this way is equivalent to a DUN arrangement; I do 
think it can work.  But the modem in the phone is not responding and 
my guess would be that the phone is still in 'automatic connection to 
the internet' and is confused by or ignoring the incoming AT commands 
from Fedora.  (Because there are some AT commands flying around in the 
phone, anyway, under Android's control as it attempts to make 
connections for its own needs.)



I think there are two details that you might search for further help with.

One is using wvdial to control an Android phone as a modem.

The other is setting an Android phone so that it can be used as a 
dial-up modem.  A possibly helpful site might be 
www.forum.xda-developers.com


Please do post back with anything you find, and especially when you 
manage to get this working, in whichever way you get this working.

regards, Ron


More information about the users mailing list