summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2013-11-25 11:33:57 -0600
committerDenis Kenzior <denkenz@gmail.com>2013-11-25 11:33:57 -0600
commit9b224fff795c8bfd72862a73c9b4e66bbd0b1916 (patch)
tree2090d8e15bd944c3e35f6b32e39ebf356275c031 /plugins
parent06598ef47c58408a9c21890f8ff344fede565724 (diff)
downloadofono-9b224fff795c8bfd72862a73c9b4e66bbd0b1916.tar.bz2
hfp_ag_bluez5: Try to support non-phone hardware
For devices which are not 'real' phone modems, the voicecall initialization can happen outside of the pre-sim state. In this case the voicecall atom detection logic fails. Try to detect the voicecall atom separately, and register the profile if the SIM atom is already present and in state 'READY'. For all other cases, the previous logic still applies.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/hfp_ag_bluez5.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/hfp_ag_bluez5.c b/plugins/hfp_ag_bluez5.c
index 245de217..9f2c8ad4 100644
--- a/plugins/hfp_ag_bluez5.c
+++ b/plugins/hfp_ag_bluez5.c
@@ -268,6 +268,41 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), modem);
}
+static void voicecall_watch(struct ofono_atom *atom,
+ enum ofono_atom_watch_condition cond,
+ void *data)
+{
+ struct ofono_atom *sim_atom;
+ struct ofono_sim *sim;
+ struct ofono_modem *modem;
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED)
+ return;
+
+ /*
+ * This logic is only intended to handle voicecall atoms
+ * registered in post_sim state or later
+ */
+ modem = __ofono_atom_get_modem(atom);
+
+ sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+ if (sim_atom == NULL)
+ return;
+
+ sim = __ofono_atom_get_data(sim_atom);
+ if (ofono_sim_get_state(sim) != OFONO_SIM_STATE_READY)
+ return;
+
+ modems = g_list_append(modems, modem);
+
+ if (modems->next != NULL)
+ return;
+
+ bt_register_profile(conn, HFP_AG_UUID, HFP_VERSION_1_5, "hfp_ag",
+ HFP_AG_EXT_PROFILE_PATH, NULL, 0);
+}
+
static void modem_watch(struct ofono_modem *modem, gboolean added, void *user)
{
DBG("modem: %p, added: %d", modem, added);
@@ -277,6 +312,8 @@ static void modem_watch(struct ofono_modem *modem, gboolean added, void *user)
__ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SIM,
sim_watch, modem, NULL);
+ __ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_VOICECALL,
+ voicecall_watch, modem, NULL);
}
static void call_modemwatch(struct ofono_modem *modem, void *user)