fbd766e26458f84842feabdcfba5cdc59c9313e3
[scm/bb/meta-tizen.git] / recipes-multimedia / pulseaudio / pulseaudio_5.0 / 0021-bluetooth-Handle-CardRemoved-signal.patch
1 From: =?utf-8?q?Jo=C3=A3o_Paulo_Rechi_Vita?= <jprvita@openbossa.org>
2 Date: Thu, 11 Jul 2013 12:53:10 -0300
3 Subject: bluetooth: Handle CardRemoved signal
4
5 Change-Id: I41083b3b5d8a318927dcdb373e871032c3f52748
6 ---
7  src/modules/bluetooth/hfaudioagent-ofono.c | 23 +++++++++++++++++++++++
8  1 file changed, 23 insertions(+)
9
10 diff --git a/src/modules/bluetooth/hfaudioagent-ofono.c b/src/modules/bluetooth/hfaudioagent-ofono.c
11 index be20257..ee158af 100644
12 --- a/src/modules/bluetooth/hfaudioagent-ofono.c
13 +++ b/src/modules/bluetooth/hfaudioagent-ofono.c
14 @@ -429,6 +429,29 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da
15  
16          hf_audio_agent_card_found(hfdata, p, &props_i);
17  
18 +    } else if (dbus_message_is_signal(m, "org.ofono.HandsfreeAudioManager", "CardRemoved")) {
19 +        const char *p;
20 +        hf_audio_card *hfac;
21 +        bool old_any_connected;
22 +
23 +        if (!dbus_message_get_args(m, &err, DBUS_TYPE_OBJECT_PATH, &p, DBUS_TYPE_INVALID)) {
24 +            pa_log_error("Failed to parse org.ofono.HandsfreeAudioManager.CardRemoved: %s", err.message);
25 +            goto fail;
26 +        }
27 +
28 +        if ((hfac = pa_hashmap_remove(hfdata->hf_audio_cards, p)) != NULL) {
29 +            old_any_connected = pa_bluetooth_device_any_transport_connected(hfac->transport->device);
30 +
31 +            hfac->transport->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
32 +            hfac->transport->device->transports[hfac->transport->profile] = NULL;
33 +            pa_hook_fire(pa_bluetooth_discovery_hook(hfdata->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED), hfac->transport);
34 +
35 +            if (old_any_connected != pa_bluetooth_device_any_transport_connected(hfac->transport->device)) {
36 +                pa_hook_fire(pa_bluetooth_discovery_hook(hfdata->discovery, PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED), hfac->transport->device);
37 +            }
38 +
39 +            hf_audio_card_free(hfac);
40 +        }
41      }
42  
43  fail: