Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH BlueZ 2/3] policy: Avoid using UUID if field is not set
@ 2020-10-16 22:09 Peter Mullen
  0 siblings, 0 replies; only message in thread
From: Peter Mullen @ 2020-10-16 22:09 UTC (permalink / raw)
  To: linux-bluetooth

---
  plugins/policy.c | 26 ++++++++++++++------------
  1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/plugins/policy.c b/plugins/policy.c
index dac1b7a24..e156c0db2 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -635,17 +635,19 @@ static void service_cb(struct btd_service *service,
  	struct btd_profile *profile = btd_service_get_profile(service);
  	struct reconnect_data *reconnect;
  -	if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID))
-		sink_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID))
-		source_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID))
-		controller_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID))
-		target_cb(service, old_state, new_state);
-	else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) ||
-			g_str_equal(profile->remote_uuid, HSP_HS_UUID))
-		hs_cb(service, old_state, new_state);
+	if (profile->remote_uuid) {
+		if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID))
+			sink_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID))
+			source_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID))
+			controller_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID))
+			target_cb(service, old_state, new_state);
+		else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) ||
+				g_str_equal(profile->remote_uuid, HSP_HS_UUID))
+			hs_cb(service, old_state, new_state);
+	}
   	/*
  	 * Return if the reconnection feature is not enabled (all
@@ -687,7 +689,7 @@ static void service_cb(struct btd_service *service,
  	 * be the first profile that's connected so we might have an
  	 * entry but with the reconnect flag set to false.
  	 */
-	if (!reconnect->reconnect)
+	if (!reconnect->reconnect && profile->remote_uuid)
  		reconnect->reconnect = reconnect_match(profile->remote_uuid);
   	DBG("Added %s reconnect %u", profile->name, reconnect->reconnect);
-- 
2.28.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 22:09 [PATCH BlueZ 2/3] policy: Avoid using UUID if field is not set Peter Mullen

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git