[pulseaudio-discuss] [RFC 15/24] bluetooth: Do not track new UUIDs
João Paulo Rechi Vita
jprvita at gmail.com
Wed Mar 27 08:54:52 PDT 2013
On Wed, Mar 27, 2013 at 5:23 AM, Mikel Astiz <mikel.astiz.oss at gmail.com> wrote:
> Hi João Paulo,
>
> On Wed, Mar 27, 2013 at 6:16 AM, <jprvita at gmail.com> wrote:
>> From: João Paulo Rechi Vita <jprvita at openbossa.org>
>>
>> ---
>> src/modules/bluetooth/bluetooth-util.c | 5 ----
>> src/modules/bluetooth/bluetooth-util.h | 1 -
>> src/modules/bluetooth/module-bluetooth-device.c | 36 -------------------------
>> 3 files changed, 42 deletions(-)
>>
>> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
>> index 419e7ac..241da41 100644
>> --- a/src/modules/bluetooth/bluetooth-util.c
>> +++ b/src/modules/bluetooth/bluetooth-util.c
>> @@ -558,7 +558,6 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo
>>
>> uuiddata.device = d;
>> uuiddata.uuid = value;
>> - pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED], &uuiddata);
>>
>> if (d->discovery->version >= BLUEZ_VERSION_5) {
>> dbus_message_iter_next(&ai);
>> @@ -2139,15 +2138,11 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
>>
>> pa_log_info("Endpoint with UUID '%s' configured before remote UUID was reported by BlueZ.", uuid);
>>
>> - /* This might generate duplicated UUID_ADDED hooks since the endpoint
>> - * doesn't receive the exact remote UUID (HSP cannot be distinguished
>> - * from HFP). However, these duplicated hooks should do no harm */
>> node = uuid_new(remote_uuid[0]);
>> PA_LLIST_PREPEND(pa_bluetooth_uuid, d->uuids, node);
>>
>> uuiddata.device = d;
>> uuiddata.uuid = uuid;
>> - pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED], &uuiddata);
>> }
>>
>> if (d->transports[p] != NULL) {
>> diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h
>> index 28f63c8..8b15320 100644
>> --- a/src/modules/bluetooth/bluetooth-util.h
>> +++ b/src/modules/bluetooth/bluetooth-util.h
>> @@ -76,7 +76,6 @@ struct pa_bluetooth_hook_uuid_data {
>> /* Hook data: pa_bluetooth_discovery pointer. */
>> typedef enum pa_bluetooth_hook {
>> PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED, /* Call data: pa_bluetooth_device */
>> - PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED, /* Call data: pa_bluetooth_hook_uuid_data */
>> PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED, /* Call data: pa_bluetooth_transport */
>> PA_BLUETOOTH_HOOK_TRANSPORT_NREC_CHANGED, /* Call data: pa_bluetooth_transport */
>> PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED, /* Call data: pa_bluetooth_transport */
>> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
>> index 5e42aa4..91eb6c9 100644
>> --- a/src/modules/bluetooth/module-bluetooth-device.c
>> +++ b/src/modules/bluetooth/module-bluetooth-device.c
>> @@ -136,7 +136,6 @@ struct userdata {
>> pa_module *module;
>>
>> pa_bluetooth_device *device;
>> - pa_hook_slot *uuid_added_slot;
>> char *address;
>> char *path;
>> pa_bluetooth_transport *transport;
>> @@ -2273,34 +2272,6 @@ static pa_bluetooth_device* find_device(struct userdata *u, const char *address,
>> }
>>
>> /* Run from main thread */
>> -static pa_hook_result_t uuid_added_cb(pa_bluetooth_discovery *y, const struct pa_bluetooth_hook_uuid_data *data,
>> - struct userdata *u) {
>> - pa_card_profile *p;
>> -
>> - pa_assert(data);
>> - pa_assert(data->device);
>> - pa_assert(data->uuid);
>> - pa_assert(u);
>> -
>> - if (data->device != u->device)
>> - return PA_HOOK_OK;
>> -
>> - p = create_card_profile(u, data->uuid);
>> -
>> - if (!p)
>> - return PA_HOOK_OK;
>> -
>> - if (pa_hashmap_get(u->card->profiles, p->name)) {
>> - pa_card_profile_free(p);
>> - return PA_HOOK_OK;
>> - }
>> -
>> - pa_card_add_profile(u->card, p);
>> -
>> - return PA_HOOK_OK;
>> -}
>> -
>> -/* Run from main thread */
>> static pa_hook_result_t discovery_hook_cb(pa_bluetooth_discovery *y, const pa_bluetooth_device *d, struct userdata *u) {
>> pa_assert(u);
>> pa_assert(d);
>> @@ -2389,10 +2360,6 @@ int pa__init(pa_module* m) {
>> pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED),
>> PA_HOOK_NORMAL, (pa_hook_cb_t) discovery_hook_cb, u);
>>
>> - u->uuid_added_slot =
>> - pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_UUID_ADDED),
>> - PA_HOOK_NORMAL, (pa_hook_cb_t) uuid_added_cb, u);
>> -
>> u->sink_state_changed_slot =
>> pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED],
>> PA_HOOK_NORMAL, (pa_hook_cb_t) sink_state_changed_cb, u);
>> @@ -2475,9 +2442,6 @@ void pa__done(pa_module *m) {
>> if (u->discovery_slot)
>> pa_hook_slot_free(u->discovery_slot);
>>
>> - if (u->uuid_added_slot)
>> - pa_hook_slot_free(u->uuid_added_slot);
>> -
>> if (u->sink_state_changed_slot)
>> pa_hook_slot_free(u->sink_state_changed_slot);
>>
>> --
>> 1.7.11.7
>>
>
> Please elaborate your commit message.
>
> I really doubt you can simply drop this late UUID handling, so perhaps
> you're adding this patch to simplify your first RFC proposal?
>
No, I really want to drop this in favor of having the card profiles
availability based on transport availability. Reasoning is elaborated
on the answer of your comments on [RFC 16/24]. I agree that the commit
message needs some love, tho.
--
João Paulo Rechi Vita
http://about.me/jprvita
More information about the pulseaudio-discuss
mailing list