From 5a6de9973754525ffb72f361b9913f18daf65b38 Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Thu, 14 Mar 2019 23:28:40 +0100 Subject: [PATCH] ublox: pass model_id to gprs-context driver Depending on the transport used on the data connection we want either the "atmodem" (PPP) driver or the "ubloxmodem". For the "ubloxmodem", we want to pass the model data so this patch wrangles some parameters to make sure that right driver and right variant data are passed. --- plugins/ublox.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/ublox.c b/plugins/ublox.c index 1c74fe09..8100dfba 100644 --- a/plugins/ublox.c +++ b/plugins/ublox.c @@ -388,19 +388,34 @@ 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->flags & UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE ? - "ubloxmodem" : "atmodem"; + const char *driver; /* Toby L2: Create same number of contexts as supported PDP contexts. */ int ncontexts = data->flags & UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE ? 8 : 1; + int variant; DBG("%p", modem); gprs = ofono_gprs_create(modem, data->vendor_family, "atmodem", data->aux); + if (ublox_is_toby_l4(data->model)) { + driver = "ubloxmodem"; + variant = ublox_model_to_id(data->model); + } else if (ublox_is_toby_l2(data->model)) { + if (data->flags & UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE) { + driver = "ubloxmodem"; + variant = ublox_model_to_id(data->model); + } else { + driver = "atmodem"; + variant = OFONO_VENDOR_UBLOX; + } + } else { + driver = "atmodem"; + variant = OFONO_VENDOR_UBLOX; + } + while (ncontexts) { - gc = ofono_gprs_context_create(modem, data->vendor_family, - driver, chat); + gc = ofono_gprs_context_create(modem, variant, driver, chat); if (gprs && gc) ofono_gprs_add_context(gprs, gc);