mirror of
https://github.com/sailfishos/ofono
synced 2025-12-03 08:01:05 +08:00
novatel: Use more standard values for control and modem channels
This commit is contained in:
@@ -52,8 +52,8 @@ static const char *none_prefix[] = { NULL };
|
|||||||
static const char *nwdmat_prefix[] = { "$NWDMAT:", NULL };
|
static const char *nwdmat_prefix[] = { "$NWDMAT:", NULL };
|
||||||
|
|
||||||
struct novatel_data {
|
struct novatel_data {
|
||||||
GAtChat *primary;
|
GAtChat *modem;
|
||||||
GAtChat *secondary;
|
GAtChat *aux;
|
||||||
gint dmat_mode;
|
gint dmat_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ static void novatel_remove(struct ofono_modem *modem)
|
|||||||
ofono_modem_set_data(modem, NULL);
|
ofono_modem_set_data(modem, NULL);
|
||||||
|
|
||||||
/* Cleanup after hot-unplug */
|
/* Cleanup after hot-unplug */
|
||||||
g_at_chat_unref(data->primary);
|
g_at_chat_unref(data->aux);
|
||||||
|
|
||||||
g_free(data);
|
g_free(data);
|
||||||
}
|
}
|
||||||
@@ -132,11 +132,11 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
g_at_chat_unref(data->secondary);
|
g_at_chat_unref(data->modem);
|
||||||
data->secondary = NULL;
|
data->modem = NULL;
|
||||||
|
|
||||||
g_at_chat_unref(data->primary);
|
g_at_chat_unref(data->aux);
|
||||||
data->primary = NULL;
|
data->aux = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ofono_modem_set_powered(modem, ok);
|
ofono_modem_set_powered(modem, ok);
|
||||||
@@ -154,25 +154,25 @@ static void nwdmat_action(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
|
|
||||||
data->dmat_mode = 1;
|
data->dmat_mode = 1;
|
||||||
|
|
||||||
data->secondary = open_device(modem, "SecondaryDevice", "Modem: ");
|
data->modem = open_device(modem, "Modem", "Modem: ");
|
||||||
if (data->secondary == NULL)
|
if (data->modem == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
g_at_chat_send(data->secondary, "ATE0 &C0 +CMEE=1", NULL,
|
g_at_chat_send(data->modem, "ATE0 &C0 +CMEE=1", NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
/* Check for all supported technologies */
|
/* Check for all supported technologies */
|
||||||
g_at_chat_send(data->primary, "AT$CNTI=2", none_prefix,
|
g_at_chat_send(data->aux, "AT$CNTI=2", none_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
g_at_chat_send(data->primary, "AT+CFUN=4", none_prefix,
|
g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
|
||||||
cfun_enable, modem, NULL);
|
cfun_enable, modem, NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_at_chat_unref(data->primary);
|
g_at_chat_unref(data->aux);
|
||||||
data->primary = NULL;
|
data->aux = NULL;
|
||||||
|
|
||||||
ofono_modem_set_powered(modem, FALSE);
|
ofono_modem_set_powered(modem, FALSE);
|
||||||
}
|
}
|
||||||
@@ -202,14 +202,14 @@ static void nwdmat_query(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_at_chat_send(data->primary, "AT$NWDMAT=1", nwdmat_prefix,
|
g_at_chat_send(data->aux, "AT$NWDMAT=1", nwdmat_prefix,
|
||||||
nwdmat_action, modem, NULL);
|
nwdmat_action, modem, NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_at_chat_unref(data->primary);
|
g_at_chat_unref(data->aux);
|
||||||
data->primary = NULL;
|
data->aux = NULL;
|
||||||
|
|
||||||
ofono_modem_set_powered(modem, FALSE);
|
ofono_modem_set_powered(modem, FALSE);
|
||||||
}
|
}
|
||||||
@@ -220,18 +220,18 @@ static int novatel_enable(struct ofono_modem *modem)
|
|||||||
|
|
||||||
DBG("%p", modem);
|
DBG("%p", modem);
|
||||||
|
|
||||||
data->primary = open_device(modem, "PrimaryDevice", "Control: ");
|
data->aux = open_device(modem, "Aux", "Aux: ");
|
||||||
if (data->primary == NULL)
|
if (data->aux == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
g_at_chat_blacklist_terminator(data->primary,
|
g_at_chat_blacklist_terminator(data->aux,
|
||||||
G_AT_CHAT_TERMINATOR_NO_CARRIER);
|
G_AT_CHAT_TERMINATOR_NO_CARRIER);
|
||||||
|
|
||||||
g_at_chat_send(data->primary, "ATE0 &C0 +CMEE=1", NULL,
|
g_at_chat_send(data->aux, "ATE0 &C0 +CMEE=1", NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
/* Check mode of seconday port */
|
/* Check mode of seconday port */
|
||||||
g_at_chat_send(data->primary, "AT$NWDMAT?", nwdmat_prefix,
|
g_at_chat_send(data->aux, "AT$NWDMAT?", nwdmat_prefix,
|
||||||
nwdmat_query, modem, NULL);
|
nwdmat_query, modem, NULL);
|
||||||
|
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
@@ -244,8 +244,8 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
g_at_chat_unref(data->primary);
|
g_at_chat_unref(data->aux);
|
||||||
data->primary = NULL;
|
data->aux = NULL;
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
ofono_modem_set_powered(modem, FALSE);
|
ofono_modem_set_powered(modem, FALSE);
|
||||||
@@ -257,19 +257,19 @@ static int novatel_disable(struct ofono_modem *modem)
|
|||||||
|
|
||||||
DBG("%p", modem);
|
DBG("%p", modem);
|
||||||
|
|
||||||
g_at_chat_cancel_all(data->secondary);
|
g_at_chat_cancel_all(data->modem);
|
||||||
g_at_chat_unregister_all(data->secondary);
|
g_at_chat_unregister_all(data->modem);
|
||||||
|
|
||||||
g_at_chat_unref(data->secondary);
|
g_at_chat_unref(data->modem);
|
||||||
data->secondary = NULL;
|
data->modem = NULL;
|
||||||
|
|
||||||
g_at_chat_cancel_all(data->primary);
|
g_at_chat_cancel_all(data->aux);
|
||||||
g_at_chat_unregister_all(data->primary);
|
g_at_chat_unregister_all(data->aux);
|
||||||
|
|
||||||
g_at_chat_send(data->primary, "AT$NWDMAT=0", nwdmat_prefix,
|
g_at_chat_send(data->aux, "AT$NWDMAT=0", nwdmat_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
g_at_chat_send(data->primary, "AT+CFUN=0", none_prefix,
|
g_at_chat_send(data->aux, "AT+CFUN=0", none_prefix,
|
||||||
cfun_disable, modem, NULL);
|
cfun_disable, modem, NULL);
|
||||||
|
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
@@ -294,7 +294,7 @@ static void novatel_set_online(struct ofono_modem *modem, ofono_bool_t online,
|
|||||||
|
|
||||||
DBG("modem %p %s", modem, online ? "online" : "offline");
|
DBG("modem %p %s", modem, online ? "online" : "offline");
|
||||||
|
|
||||||
if (g_at_chat_send(data->primary, command, none_prefix,
|
if (g_at_chat_send(data->aux, command, none_prefix,
|
||||||
set_online_cb, cbd, g_free) > 0)
|
set_online_cb, cbd, g_free) > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -310,9 +310,9 @@ static void novatel_pre_sim(struct ofono_modem *modem)
|
|||||||
|
|
||||||
DBG("%p", modem);
|
DBG("%p", modem);
|
||||||
|
|
||||||
ofono_devinfo_create(modem, 0, "atmodem", data->primary);
|
ofono_devinfo_create(modem, 0, "atmodem", data->aux);
|
||||||
sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
||||||
"atmodem", data->primary);
|
"atmodem", data->aux);
|
||||||
|
|
||||||
if (sim)
|
if (sim)
|
||||||
ofono_sim_inserted_notify(sim, TRUE);
|
ofono_sim_inserted_notify(sim, TRUE);
|
||||||
@@ -324,9 +324,9 @@ static void novatel_post_sim(struct ofono_modem *modem)
|
|||||||
|
|
||||||
DBG("%p", modem);
|
DBG("%p", modem);
|
||||||
|
|
||||||
ofono_phonebook_create(modem, 0, "atmodem", data->primary);
|
ofono_phonebook_create(modem, 0, "atmodem", data->aux);
|
||||||
ofono_radio_settings_create(modem, 0, "nwmodem", data->primary);
|
ofono_radio_settings_create(modem, 0, "nwmodem", data->aux);
|
||||||
ofono_sms_create(modem, OFONO_VENDOR_NOVATEL, "atmodem", data->primary);
|
ofono_sms_create(modem, OFONO_VENDOR_NOVATEL, "atmodem", data->aux);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void novatel_post_online(struct ofono_modem *modem)
|
static void novatel_post_online(struct ofono_modem *modem)
|
||||||
@@ -338,15 +338,15 @@ static void novatel_post_online(struct ofono_modem *modem)
|
|||||||
DBG("%p", modem);
|
DBG("%p", modem);
|
||||||
|
|
||||||
ofono_netreg_create(modem, OFONO_VENDOR_NOVATEL, "atmodem",
|
ofono_netreg_create(modem, OFONO_VENDOR_NOVATEL, "atmodem",
|
||||||
data->primary);
|
data->aux);
|
||||||
|
|
||||||
ofono_cbs_create(modem, OFONO_VENDOR_QUALCOMM_MSM, "atmodem",
|
ofono_cbs_create(modem, OFONO_VENDOR_QUALCOMM_MSM, "atmodem",
|
||||||
data->primary);
|
data->aux);
|
||||||
ofono_ussd_create(modem, 0, "atmodem", data->primary);
|
ofono_ussd_create(modem, 0, "atmodem", data->aux);
|
||||||
|
|
||||||
gprs = ofono_gprs_create(modem, OFONO_VENDOR_NOVATEL,
|
gprs = ofono_gprs_create(modem, OFONO_VENDOR_NOVATEL,
|
||||||
"atmodem", data->primary);
|
"atmodem", data->aux);
|
||||||
gc = ofono_gprs_context_create(modem, 0, "atmodem", data->secondary);
|
gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
|
||||||
|
|
||||||
if (gprs && gc)
|
if (gprs && gc)
|
||||||
ofono_gprs_add_context(gprs, gc);
|
ofono_gprs_add_context(gprs, gc);
|
||||||
|
|||||||
Reference in New Issue
Block a user