Create multiple gprs-context instances and let the gprs core use
them as it sees fit.

Only for Toby L2.
---
 plugins/ublox.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/plugins/ublox.c b/plugins/ublox.c
index c47c6aa..8f6b3f1 100644
--- a/plugins/ublox.c
+++ b/plugins/ublox.c
@@ -295,21 +295,25 @@ static void ublox_post_sim(struct ofono_modem *modem)
        struct ofono_gprs *gprs;
        struct ofono_gprs_context *gc;
        GAtChat *chat = data->modem ? data->modem : data->aux;
+       const char *driver = data->model_id == TOBYL2_HIGH_THROUGHPUT_MODE ?
+                                               "ubloxmodem" : "atmodem";
+       /* Toby L2: Create same number of contexts as supported PDP contexts. */
+       int ncontexts = data->model_id == TOBYL2_HIGH_THROUGHPUT_MODE ? 8 : 1;
 
        DBG("%p", modem);
 
        gprs = ofono_gprs_create(modem, data->vendor_family, "atmodem",
                                        data->aux);
-       if (data->model_id == TOBYL2_HIGH_THROUGHPUT_MODE)
-               gc = ofono_gprs_context_create(modem, data->vendor_family,
-                                               "ubloxmodem", chat);
 
-       else
+       while (ncontexts) {
                gc = ofono_gprs_context_create(modem, data->vendor_family,
-                                               "atmodem", chat);
+                                               driver, chat);
 
-       if (gprs && gc)
-               ofono_gprs_add_context(gprs, gc);
+               if (gprs && gc)
+                       ofono_gprs_add_context(gprs, gc);
+
+               --ncontexts;
+       }
 }
 
 static void ublox_post_online(struct ofono_modem *modem)
-- 
2.5.0

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to