mirror of git://git.sysmocom.de/ofono
nokia: Use post_online callback even without onfline/offline support
This commit is contained in:
parent
b27b7ff309
commit
bfe5731cd6
|
@ -49,7 +49,7 @@ static const char *none_prefix[] = { NULL };
|
|||
|
||||
struct nokia_data {
|
||||
GAtChat *modem;
|
||||
GAtChat *control;
|
||||
GAtChat *aux;
|
||||
};
|
||||
|
||||
static int nokia_probe(struct ofono_modem *modem)
|
||||
|
@ -76,7 +76,7 @@ static void nokia_remove(struct ofono_modem *modem)
|
|||
ofono_modem_set_data(modem, NULL);
|
||||
|
||||
/* Cleanup after hot-unplug */
|
||||
g_at_chat_unref(data->control);
|
||||
g_at_chat_unref(data->aux);
|
||||
|
||||
g_free(data);
|
||||
}
|
||||
|
@ -132,8 +132,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
g_at_chat_unref(data->modem);
|
||||
data->modem = NULL;
|
||||
|
||||
g_at_chat_unref(data->control);
|
||||
data->control = NULL;
|
||||
g_at_chat_unref(data->aux);
|
||||
data->aux = NULL;
|
||||
}
|
||||
|
||||
ofono_modem_set_powered(modem, ok);
|
||||
|
@ -149,8 +149,8 @@ static int nokia_enable(struct ofono_modem *modem)
|
|||
if (data->modem == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
data->control = open_device(modem, "Control", "Control: ");
|
||||
if (data->control == NULL) {
|
||||
data->aux = open_device(modem, "Aux", "Aux: ");
|
||||
if (data->aux == NULL) {
|
||||
g_at_chat_unref(data->modem);
|
||||
data->modem = NULL;
|
||||
return -EIO;
|
||||
|
@ -159,10 +159,10 @@ static int nokia_enable(struct ofono_modem *modem)
|
|||
g_at_chat_send(data->modem, "ATE0 &C0 +CMEE=1", NULL,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
g_at_chat_send(data->control, "ATE0 &C0 +CMEE=1", NULL,
|
||||
g_at_chat_send(data->aux, "ATE0 &C0 +CMEE=1", NULL,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
g_at_chat_send(data->control, "AT+CFUN=1", none_prefix,
|
||||
g_at_chat_send(data->aux, "AT+CFUN=1", none_prefix,
|
||||
cfun_enable, modem, NULL);
|
||||
|
||||
return -EINPROGRESS;
|
||||
|
@ -175,8 +175,8 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
|
||||
DBG("");
|
||||
|
||||
g_at_chat_unref(data->control);
|
||||
data->control = NULL;
|
||||
g_at_chat_unref(data->aux);
|
||||
data->aux = NULL;
|
||||
|
||||
if (ok)
|
||||
ofono_modem_set_powered(modem, FALSE);
|
||||
|
@ -194,10 +194,10 @@ static int nokia_disable(struct ofono_modem *modem)
|
|||
g_at_chat_unref(data->modem);
|
||||
data->modem = NULL;
|
||||
|
||||
g_at_chat_cancel_all(data->control);
|
||||
g_at_chat_unregister_all(data->control);
|
||||
g_at_chat_cancel_all(data->aux);
|
||||
g_at_chat_unregister_all(data->aux);
|
||||
|
||||
g_at_chat_send(data->control, "AT+CFUN=4", none_prefix,
|
||||
g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
|
||||
cfun_disable, modem, NULL);
|
||||
|
||||
return -EINPROGRESS;
|
||||
|
@ -210,8 +210,8 @@ static void nokia_pre_sim(struct ofono_modem *modem)
|
|||
|
||||
DBG("%p", modem);
|
||||
|
||||
ofono_devinfo_create(modem, 0, "atmodem", data->control);
|
||||
sim = ofono_sim_create(modem, 0, "atmodem", data->control);
|
||||
ofono_devinfo_create(modem, 0, "atmodem", data->aux);
|
||||
sim = ofono_sim_create(modem, 0, "atmodem", data->aux);
|
||||
|
||||
if (sim)
|
||||
ofono_sim_inserted_notify(sim, TRUE);
|
||||
|
@ -225,23 +225,32 @@ static void nokia_post_sim(struct ofono_modem *modem)
|
|||
|
||||
DBG("%p", modem);
|
||||
|
||||
ofono_netreg_create(modem, OFONO_VENDOR_NOKIA,
|
||||
"atmodem", data->control);
|
||||
ofono_phonebook_create(modem, 0, "atmodem", data->aux);
|
||||
|
||||
ofono_sms_create(modem, OFONO_VENDOR_OPTION_HSO,
|
||||
"atmodem", data->control);
|
||||
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
||||
"atmodem", data->control);
|
||||
ofono_phonebook_create(modem, 0, "atmodem", data->control);
|
||||
"atmodem", data->aux);
|
||||
|
||||
gprs = ofono_gprs_create(modem, OFONO_VENDOR_NOKIA,
|
||||
"atmodem", data->control);
|
||||
"atmodem", data->aux);
|
||||
gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
|
||||
|
||||
if (gprs && gc)
|
||||
ofono_gprs_add_context(gprs, gc);
|
||||
}
|
||||
|
||||
static void nokia_post_online(struct ofono_modem *modem)
|
||||
{
|
||||
struct nokia_data *data = ofono_modem_get_data(modem);
|
||||
|
||||
DBG("%p", modem);
|
||||
|
||||
ofono_netreg_create(modem, OFONO_VENDOR_NOKIA,
|
||||
"atmodem", data->aux);
|
||||
|
||||
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
|
||||
"atmodem", data->aux);
|
||||
}
|
||||
|
||||
static struct ofono_modem_driver nokia_driver = {
|
||||
.name = "nokia",
|
||||
.probe = nokia_probe,
|
||||
|
@ -250,6 +259,7 @@ static struct ofono_modem_driver nokia_driver = {
|
|||
.disable = nokia_disable,
|
||||
.pre_sim = nokia_pre_sim,
|
||||
.post_sim = nokia_post_sim,
|
||||
.post_online = nokia_post_online,
|
||||
};
|
||||
|
||||
static int nokia_init(void)
|
||||
|
|
Loading…
Reference in New Issue