diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-10-24 20:00:32 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-10-24 20:00:32 +0200 |
commit | 4a5f37dafdecf567e372b90adb38d41281d6e213 (patch) | |
tree | 36d22260faaf1dd43722c9b470b8644e89041c7a /plugins/ifx.c | |
parent | 3342af770aeaec51735a68c2bebd074d008868ff (diff) | |
download | ofono-4a5f37dafdecf567e372b90adb38d41281d6e213.tar.bz2 |
ifx: Detect modems stuck in multiplexer mode
When the initial AT commands on the master device don't respond, then
the modem is stuck in multiplexer mode. For now just report an error.
Diffstat (limited to 'plugins/ifx.c')
-rw-r--r-- | plugins/ifx.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/ifx.c b/plugins/ifx.c index 9aa8b0bf..430db22a 100644 --- a/plugins/ifx.c +++ b/plugins/ifx.c @@ -86,6 +86,7 @@ struct ifx_data { guint dlc_poll_count; guint dlc_poll_source; guint dlc_init_source; + guint mux_init_timeout; guint frame_size; int mux_ldisc; int saved_ldisc; @@ -462,6 +463,11 @@ static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data) DBG(""); + if (data->mux_init_timeout > 0) { + g_source_remove(data->mux_init_timeout); + data->mux_init_timeout = 0; + } + g_at_chat_unref(data->dlcs[AUX_DLC]); data->dlcs[AUX_DLC] = NULL; @@ -501,6 +507,26 @@ error: ofono_modem_set_powered(modem, FALSE); } +static gboolean mux_timeout_cb(gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct ifx_data *data = ofono_modem_get_data(modem); + + ofono_error("Timeout with multiplexer setup"); + + data->mux_init_timeout = 0; + + g_at_chat_unref(data->dlcs[AUX_DLC]); + data->dlcs[AUX_DLC] = NULL; + + g_io_channel_unref(data->device); + data->device = NULL; + + ofono_modem_set_powered(modem, FALSE); + + return FALSE; +} + static int ifx_enable(struct ofono_modem *modem) { struct ifx_data *data = ofono_modem_get_data(modem); @@ -559,6 +585,9 @@ static int ifx_enable(struct ofono_modem *modem) g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL, mux_setup_cb, modem, NULL); + data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb, + modem); + data->dlcs[AUX_DLC] = chat; return -EINPROGRESS; |