diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-04 17:36:51 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-09-04 17:36:51 +0300 |
commit | 4449fea64a582999d9bcf4a5f91832c9fdf1e389 (patch) | |
tree | d8b35d60c34107985d5c00d80e3ea4be6181b917 /audio/headset.c | |
parent | de6c33d2666072676a7e2afc8b9be6f2804242c1 (diff) |
Disallow HFP connections when the telephony plugin isn't yet initialized
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index 74093afa..6ab949cf 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -1108,6 +1108,10 @@ static DBusMessage *hs_connect(DBusConnection *conn, DBusMessage *msg, ".AlreadyConnected", "Already Connected"); + if (hs->hfp_handle && !ag.telephony_ready) + return g_dbus_create_error(msg, ERROR_INTERFACE ".NotReady", + "Telephony subsystem not ready"); + err = rfcomm_connect(device, NULL, NULL, NULL); if (err < 0) return g_dbus_create_error(msg, ERROR_INTERFACE @@ -1827,6 +1831,14 @@ void headset_set_authorized(struct audio_device *dev) { struct headset *hs = dev->headset; + /* For HFP telephony isn't ready just disconnect */ + if (hs->hfp_active && !ag.telephony_ready) { + error("Unable to accept HFP connection since the telephony " + "subsystem isn't initialized"); + headset_set_state(dev, HEADSET_STATE_DISCONNECTED); + return; + } + hs->rfcomm = hs->tmp_rfcomm; hs->tmp_rfcomm = NULL; @@ -1836,6 +1848,7 @@ void headset_set_authorized(struct audio_device *dev) hs->auto_dc = FALSE; + /* For HSP (no special SLC setup) move to CONNECTED state */ if (!hs->hfp_active) headset_set_state(dev, HEADSET_STATE_CONNECTED); } |