diff options
author | Pekka Pessi <Pekka.Pessi@nokia.com> | 2010-05-27 19:29:51 +0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-05-27 12:44:40 -0500 |
commit | 7d1c404a6ae9b8076c4e43c15000340f7b452a58 (patch) | |
tree | f7cdabc40008484aecb07c228d99c2f2f42a6b70 /src | |
parent | 603ff15e6bb446737094a75afaa8f0e9673515c4 (diff) | |
download | ofono-7d1c404a6ae9b8076c4e43c15000340f7b452a58.tar.bz2 |
modem: Fix inconsistent state
Keep modem state consistent if sim is removed while set_online
driver call is pending. This results in set_online callback being
called and modem entering an invalid state.
Diffstat (limited to 'src')
-rw-r--r-- | src/modem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modem.c b/src/modem.c index a99d792a..5f3821bb 100644 --- a/src/modem.c +++ b/src/modem.c @@ -410,14 +410,16 @@ static void online_cb(const struct ofono_error *error, void *data) struct ofono_modem *modem = data; DBusMessage *reply; - if (error->type == OFONO_ERROR_TYPE_NO_ERROR) + if (error->type == OFONO_ERROR_TYPE_NO_ERROR && + modem->modem_state == MODEM_STATE_OFFLINE) reply = dbus_message_new_method_return(modem->pending); else reply = __ofono_error_failed(modem->pending); __ofono_dbus_pending_reply(&modem->pending, reply); - if (error->type == OFONO_ERROR_TYPE_NO_ERROR) + if (error->type == OFONO_ERROR_TYPE_NO_ERROR && + modem->modem_state == MODEM_STATE_OFFLINE) modem_change_state(modem, MODEM_STATE_ONLINE); } @@ -433,7 +435,8 @@ static void offline_cb(const struct ofono_error *error, void *data) __ofono_dbus_pending_reply(&modem->pending, reply); - if (error->type == OFONO_ERROR_TYPE_NO_ERROR) + if (error->type == OFONO_ERROR_TYPE_NO_ERROR && + modem->modem_state == MODEM_STATE_ONLINE) modem_change_state(modem, MODEM_STATE_OFFLINE); } |