summaryrefslogtreecommitdiffstats
path: root/plugins/hso.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-01-01 18:00:39 -0800
committerMarcel Holtmann <marcel@holtmann.org>2012-01-01 18:00:39 -0800
commit0b82269b113d09855d2c470651c4f0a7e8a8bce6 (patch)
tree6d5fd4d3e9c49899b0bd8ac1cde78d9a638ac07a /plugins/hso.c
parent68ff1c46e5624613f09f4f82cc21cc23466039a9 (diff)
downloadofono-0b82269b113d09855d2c470651c4f0a7e8a8bce6.tar.bz2
hso: Add support for detecting is no SIM card is present
Diffstat (limited to 'plugins/hso.c')
-rw-r--r--plugins/hso.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/hso.c b/plugins/hso.c
index 897cd120..ed1a4c14 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -58,7 +58,7 @@ struct hso_data {
GAtChat *control;
guint sim_poll_source;
guint sim_poll_count;
- gboolean have_sim;
+ ofono_bool_t have_sim;
};
static int hso_probe(struct ofono_modem *modem)
@@ -144,7 +144,8 @@ static void sim_status(gboolean ok, GAtResult *result, gpointer user_data)
DBG("status sim %d pb %d sms %d", sim, pb, sms);
- if (sim == 0) {
+ switch (sim) {
+ case 0: /* not ready */
data->have_sim = FALSE;
if (data->sim_poll_count++ < 5) {
@@ -152,12 +153,24 @@ static void sim_status(gboolean ok, GAtResult *result, gpointer user_data)
init_sim_check, modem);
return;
}
- } else
+ break;
+ case 1: /* SIM card ready */
data->have_sim = TRUE;
+ break;
+ case 2: /* no SIM card */
+ data->have_sim = FALSE;
+ break;
+ default:
+ data->have_sim = FALSE;
+ break;
+ }
data->sim_poll_count = 0;
- ofono_modem_set_powered(modem, TRUE);
+ ofono_modem_set_powered(modem, data->have_sim);
+
+ if (data->have_sim == FALSE)
+ return;
/*
* Option has the concept of Speech Service versus