mirror of git://git.sysmocom.de/ofono
wavecom: Always disable the modem when enabling it
we don't want to deal with any stale state, e.g. if the modem was already powered up and in CFUN=1 state at the time ofonod was started.
This commit is contained in:
parent
0b182dc173
commit
24ba6f8923
|
@ -145,31 +145,18 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
ofono_modem_set_powered(modem, TRUE);
|
ofono_modem_set_powered(modem, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cfun_query(gboolean ok, GAtResult *result, gpointer user_data)
|
static void cfun_disable2enable(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
GAtChat *chat = ofono_modem_get_data(modem);
|
GAtChat *chat = ofono_modem_get_data(modem);
|
||||||
GAtResultIter iter;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
DBG("ok %d", ok);
|
DBG("ok %d", ok);
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_at_result_iter_init(&iter, result);
|
g_at_chat_send(chat, "AT+CFUN=1", none_prefix,
|
||||||
|
cfun_enable, modem, NULL);
|
||||||
if (g_at_result_iter_next(&iter, "+CFUN:") == FALSE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_at_result_iter_next_number(&iter, &status);
|
|
||||||
|
|
||||||
if (status != 1) {
|
|
||||||
g_at_chat_send(chat, "AT+CFUN=1", none_prefix,
|
|
||||||
cfun_enable, modem, NULL);
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
ofono_modem_set_powered(modem, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wind_set(gboolean ok, GAtResult *result, gpointer user_data)
|
static void wind_set(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
@ -237,8 +224,8 @@ static int wavecom_enable(struct ofono_modem *modem)
|
||||||
g_at_chat_send(chat, "AT+WIND=32767", wind_prefix,
|
g_at_chat_send(chat, "AT+WIND=32767", wind_prefix,
|
||||||
wind_set, modem, NULL);
|
wind_set, modem, NULL);
|
||||||
|
|
||||||
g_at_chat_send(chat, "AT+CFUN?", cfun_prefix,
|
g_at_chat_send(chat, "AT+CFUN=0", cfun_prefix,
|
||||||
cfun_query, modem, NULL);
|
cfun_disable2enable, modem, NULL);
|
||||||
|
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue