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.
This commit is contained in:
Jonas Bonn 2019-03-14 23:28:40 +01:00 committed by Denis Kenzior
parent d393863486
commit 5a6de99737
1 changed files with 19 additions and 4 deletions

View File

@ -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);