From 9ae4da94899bbacb87eb912cbc9a7620b2b60255 Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Fri, 26 Apr 2013 08:16:58 +0200 Subject: [PATCH] control: Simplify UUID handling during probe There is actually one single UUID which can be received during probe, so simplify the code accordingly. --- profiles/audio/control.c | 8 ++++---- profiles/audio/control.h | 4 ++-- profiles/audio/manager.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/profiles/audio/control.c b/profiles/audio/control.c index 6086bde66..fd5ff92cd 100644 --- a/profiles/audio/control.c +++ b/profiles/audio/control.c @@ -253,13 +253,13 @@ void control_unregister(struct audio_device *dev) AUDIO_CONTROL_INTERFACE); } -void control_update(struct control *control, GSList *uuids) +void control_update(struct control *control, const char *uuid) { - if (g_slist_find_custom(uuids, AVRCP_TARGET_UUID, bt_uuid_strcmp)) + if (bt_uuid_strcmp(uuid, AVRCP_TARGET_UUID) == 0) control->target = TRUE; } -struct control *control_init(struct audio_device *dev, GSList *uuids) +struct control *control_init(struct audio_device *dev, const char *uuid) { struct control *control; @@ -276,7 +276,7 @@ struct control *control_init(struct audio_device *dev, GSList *uuids) control = g_new0(struct control, 1); - control_update(control, uuids); + control_update(control, uuid); control->avctp_id = avctp_add_state_cb(dev, state_changed); diff --git a/profiles/audio/control.h b/profiles/audio/control.h index de0259e3d..82ad0d2b0 100644 --- a/profiles/audio/control.h +++ b/profiles/audio/control.h @@ -24,8 +24,8 @@ #define AUDIO_CONTROL_INTERFACE "org.bluez.MediaControl1" -struct control *control_init(struct audio_device *dev, GSList *uuids); -void control_update(struct control *control, GSList *uuids); +struct control *control_init(struct audio_device *dev, const char *uuid); +void control_update(struct control *control, const char *uuid); void control_unregister(struct audio_device *dev); gboolean control_is_active(struct audio_device *dev); diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c index 45178155e..8131a3e6f 100644 --- a/profiles/audio/manager.c +++ b/profiles/audio/manager.c @@ -145,9 +145,9 @@ static int avrcp_probe(struct btd_profile *p, struct btd_device *device, } if (audio_dev->control) - control_update(audio_dev->control, uuids); + control_update(audio_dev->control, p->remote_uuid); else - audio_dev->control = control_init(audio_dev, uuids); + audio_dev->control = control_init(audio_dev, p->remote_uuid); if (audio_dev->sink && sink_is_active(audio_dev)) avrcp_connect(audio_dev); -- 2.47.3