Skip to contentSkip to conversation

connect 2 APN at the same time (PPP and QMI)

help Mylene Josserand 2 participants 7 messages Dec 3, 2014 – Dec 5, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi everyone,

I am new to Ofono and I need some advices.

My modem has two interfaces : one interface on which I can do a PPP connection and another interface QMI to make wwan connection. My SIM card has 2 APNs and I must connect to them simultaneously. So, I need to be connected in PPP with APN1 and in qmi/wwan with APN2.

The two ways of being connected work. I have successfully configured "2 ofonos" to make my modem works with "atmodem" for the PPP side and, by setting ofono driver to gobi in udevng (such as Huawei does) for wwan side. To sum up, Ofono works with PPP or with QMI. Now, I need to make it work with PPP _and_ QMI at the same time.

I tried to connect, on the same modem, in my plugin file, the interface "Device" to "qmimodem" driver (so what "gobi" plugin does) and the "Application" and "Modem" interfaces to "atmodem" driver but it failed because dbus interfaces already exist (created by the first called).

So I was wondering : what should be the best way to do it ? And is it possible ? Should I create one modem with 2 drivers (with my own driver using atmodem and gobi driver) ? Or should I create 2 modems with each one the driver needed (gobi/qmimodem and my own driver/atmodem) ?

I am using Ofono v1.15. If you need more information, do not hesitate.

Thank you in advance for any advices or help

Best regards,

Mylène

#2 lore raw

Hi Mylene,

Quoted 4 lines

My modem has two interfaces : one interface on which I can do a PPP connection and another interface QMI to make wwan connection. My SIM card has 2 APNs and I must connect to them simultaneously. So, I need to be connected in PPP with APN1 and in qmi/wwan with APN2.

This sort of depends on whether your hardware actually supports multiple contexts being activated at once.

Quoted 8 lines

The two ways of being connected work. I have successfully configured "2 ofonos" to make my modem works with "atmodem" for the PPP side and, by setting ofono driver to gobi in udevng (such as Huawei does) for wwan side. To sum up, Ofono works with PPP or with QMI. Now, I need to make it work with PPP _and_ QMI at the same time.

I tried to connect, on the same modem, in my plugin file, the interface "Device" to "qmimodem" driver (so what "gobi" plugin does) and the "Application" and "Modem" interfaces to "atmodem" driver but it failed because dbus interfaces already exist (created by the first called).

So I was wondering : what should be the best way to do it ? And is it possible ? Should I create one modem with 2 drivers (with my own driver using atmodem and gobi driver) ? Or should I create 2 modems with each one the driver needed (gobi/qmimodem and my own driver/atmodem) ?

You could try modifying the gobi plugin and udevng to allocate 2 gprs-contexts. One using the QMI driver and the other using PPP.

e.g. something like:

gc = ofono_gprs_context_create(modem, 0, "qmimodem", device); ofono_gprs_add_context(gprs, gc);

gc = ofono_gprs_context_create(modem, 0, "atmodem", ppp_chat); ofono_gprs_add_context(gprs, gc);

and see if that works.

Regards,
-Denis

#3 lore raw

Hi Denis,

Thank you for your help. I really appreciate.

Quoted 3 lines

This sort of depends on whether your hardware actually supports multiple
contexts being activated at once.

For this, it is okay. My hardware can have 3 contexts activated at the same time.

Quoted 5 lines

You could try modifying the gobi plugin and udevng to allocate 2 gprs-contexts. One using the QMI driver and the other using PPP.

e.g. something like:

Quoted 7 lines

gc = ofono_gprs_context_create(modem, 0, "qmimodem", device); ofono_gprs_add_context(gprs, gc);

gc = ofono_gprs_context_create(modem, 0, "atmodem", ppp_chat); ofono_gprs_add_context(gprs, gc);

and see if that works.

I have tried it but, with the dbus method GetContext, only one context is shown (the QMI ones). The "at_gprs_context_probe" is called but failed at "g_at_chat_get_slave".
I checked the gcd->chat and it is not NULL so it seems to come to the slave.

What is it for ? What have I missed ?

Thank you in advance,

Best regards,

Mylène

#4 lore raw

Hi again,

Quoted 10 lines

I have tried it but, with the dbus method GetContext, only one context is shown (the QMI ones).
The "at_gprs_context_probe" is called but failed at "g_at_chat_get_slave".
I checked the gcd->chat and it is not NULL so it seems to come to the slave.

What is it for ? What have I missed ?

I continued to look around and I succeed to make it work !

I looked to other modem plugins. I think I understand what the slave is thanks to that. It is the other interfaces to send AT commands, only, whereas the "main" GAtChat serves to create the PPP connection, is not it ? If I am wrong, do not hesitate to make me understand how it works.

I set the slave (via "g_at_chat_set_slave") to my "Application" device and I succeeded to get 2 contexts. I activate them and it creates the PPP and QMI connections ! I still have a problem : I did not get an IP address on one of the APN connection but this is another problem (connman ?) and I will search alone for that before asking for help :)

Anyway, thank you for the help you gave me !

Best regards,

Mylène

#5 lore raw

Hi Mylene,

Quoted 3 lines

I looked to other modem plugins. I think I understand what the slave is thanks to that. It is the other interfaces to send AT commands, only, whereas the "main" GAtChat serves to create the PPP connection, is not it ? If I am wrong, do not hesitate to make me understand how it works.

Pretty much. When we pass the chat to the gprs_context driver we set the slave chat. This is needed in order to monitor certain events which come in via AT commands when the PPP link is active. In effect we require 2 AT command ports.

On some hardware there was only a single functional PPP port, so the driver might need to be modified to handle that case, but it sounds like you don't have this issue.

Quoted 2 lines

I set the slave (via "g_at_chat_set_slave") to my "Application" device and I succeeded to get 2 contexts. I activate them and it creates the PPP and QMI connections ! I still have a problem : I did not get an IP address on one of the APN connection but this is another problem (connman ?) and I will search alone for that before asking for help :)

Cool, feel free to send a patch for this.

IP settings are notified to oFono by the gprs_context driver. If there are IP settings given, then most likely they should be obtained via DHCP. Running test/list-contexts should tell you all the information once both contexts are active.

Regards,
-Denis

#6 lore raw

Hi Denis,

Quoted 5 lines

Pretty much. When we pass the chat to the gprs_context driver we set the slave chat. This is needed in order to monitor certain events which
come in via AT commands when the PPP link is active. In effect we require 2 AT command ports.

ok, thank you for the explanation.

Quoted 4 lines

On some hardware there was only a single functional PPP port, so the driver might need to be modified to handle that case, but it sounds like
you don't have this issue.

Yes, I have 2 AT command ports but I understand that it must be handled differently with only one AT port.

Quoted 8 lines

Cool, feel free to send a patch for this.

IP settings are notified to oFono by the gprs_context driver. If there
are IP settings given, then most likely they should be obtained via DHCP. Running test/list-contexts should tell you all the information once both contexts are active.

Yes, I already used this test and sent some "dbus-send" command lines to get informations. I get an IP address according to ofono :

[ /modem_0 ]
[ /modem_0/context1 ]
Username =
AuthenticationMethod = chap Protocol = ip
Name = Internet
Settings = { Interface=wwan0 Method=dhcp } IPv6.Settings = { }
Active = 1
AccessPointName = APN1
Password =
Type = internet

[ /modem_0/context2 ]
Username =
AuthenticationMethod = chap
Protocol = ip
Name = Internet
Settings = { Interface=ppp0 Netmask=255.255.255.255 Method=static DomainNameServers=0.0.0.0,0.0.0.0, Address=30.1.63.4 } IPv6.Settings = { }
Active = 1
AccessPointName = APN2
Password =
Type = internet

but with ifconfig, I did not get the IP address on the PPP0 interface (in this example) :

ppp0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

wwan0 Link encap:Ethernet HWaddr 16:12:29:6F:55:C7
inet addr:217.200.57.222 Bcast:217.200.57.223 Mask:255.255.255.252 inet6 addr: fe80::1412:29ff:fe6f:55c7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:1726 (1.6 KiB) TX bytes:8044 (7.8 KiB)

I run more tests and I tried to exchange the APN names and my problem is not linked to APNs, it is linked to the context2. Whatever APN and whatever interfaces (PPP or QMI) is selected in context 2, it did not get an IP address. So PPP or QMI connections are ok, APN1 or APN2 are ok, this seems to be a context 2 problem.

I looked deeper in connman's code (which I think is the problem). And, in debug mode, for the 2nd context, the "context_changed" function is called twice with no "Settings" and no "Active" parameters read.

For context 1 :

connmand[1537]: plugins/ofono.c:context_changed() context_path /modem_0/context1 connmand[1537]: plugins/ofono.c:context_changed() /modem_0 Settings connmand[1537]: plugins/ofono.c:extract_ipv4_settings() Interface wwan0 connmand[1537]: plugins/ofono.c:extract_ipv4_settings() index 35 connmand[1537]: plugins/ofono.c:extract_ipv4_settings() Method dhcp connmand[1537]: plugins/ofono.c:context_changed() context_path /modem_0/context1 connmand[1537]: plugins/ofono.c:context_changed() /modem_0 Active 1 connmand[1537]: plugins/ofono.c:set_connected() /modem_0

whereas, for context 2 :

connmand[1341]: plugins/ofono.c:context_changed() context_path /modem_0/context2 connmand[1341]: plugins/ofono.c:context_changed() context_path /modem_0/context2

I am going to read/add debug in connman's code (plugin/ofono.c), I will post again if I find something.

Best regards,

Mylène

#7 lore raw
Quoted 3 lines

I am going to read/add debug in connman's code (plugin/ofono.c), I will post again if I find something.

I found something _very_ useful : https://github.com/aldebaran/connman/blob/master/plugins/ofono.c#L1074

Connman supports only one Internet context per modem that is why my 2nd context did not work.

I will search how to handle that (and, maybe, ask some help to connman mail list).

Best regards,

Mylène