All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported
@ 2022-08-30 21:54 Luiz Augusto von Dentz
  2022-08-30 23:00 ` [BlueZ] " bluez.test.bot
  2022-08-31 23:10 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-30 21:54 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If adapter don't support ISO sockets the PAC UUIDs shall not be allowed
to be registered as they depend on ISO sockets to work properly.
---
 profiles/audio/media.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 85278a6d9be4..a7fa85d60310 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1254,20 +1254,23 @@ static bool endpoint_properties_get(const char *uuid,
 	return true;
 }
 
-static bool endpoint_supported(void)
+static bool endpoint_supported(struct btd_adapter *adapter)
 {
 	return true;
 }
 
-static bool experimental_endpoint_supported(void)
+static bool experimental_endpoint_supported(struct btd_adapter *adapter)
 {
+	if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET))
+		return false;
+
 	return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
 }
 
 static struct media_endpoint_init {
 	const char *uuid;
 	bool (*func)(struct media_endpoint *endpoint, int *err);
-	bool (*supported)(void);
+	bool (*supported)(struct btd_adapter *adapter);
 } init_table[] = {
 	{ A2DP_SOURCE_UUID, endpoint_init_a2dp_source, endpoint_supported },
 	{ A2DP_SINK_UUID, endpoint_init_a2dp_sink, endpoint_supported },
@@ -1315,6 +1318,9 @@ media_endpoint_create(struct media_adapter *adapter,
 	for (i = 0; i < ARRAY_SIZE(init_table); i++) {
 		init = &init_table[i];
 
+		if (!init->supported(adapter->btd_adapter))
+			continue;
+
 		if (!strcasecmp(init->uuid, uuid)) {
 			succeeded = init->func(endpoint, err);
 			break;
@@ -2971,6 +2977,7 @@ static const GDBusMethodTable media_methods[] = {
 static gboolean supported_uuids(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
+	struct media_adapter *adapter = data;
 	DBusMessageIter entry;
 	size_t i;
 
@@ -2980,7 +2987,7 @@ static gboolean supported_uuids(const GDBusPropertyTable *property,
 	for (i = 0; i < ARRAY_SIZE(init_table); i++) {
 		struct media_endpoint_init *init = &init_table[i];
 
-		if (init->supported())
+		if (init->supported(adapter->btd_adapter))
 			dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
 							&init->uuid);
 	}
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported
  2022-08-30 21:54 [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported Luiz Augusto von Dentz
@ 2022-08-30 23:00 ` bluez.test.bot
  2022-08-31 23:10 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-08-30 23:00 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=672619

---Test result---

Test Summary:
CheckPatch                    PASS      1.17 seconds
GitLint                       PASS      0.80 seconds
Prep - Setup ELL              PASS      26.48 seconds
Build - Prep                  PASS      0.67 seconds
Build - Configure             PASS      8.22 seconds
Build - Make                  PASS      727.87 seconds
Make Check                    PASS      11.61 seconds
Make Check w/Valgrind         PASS      285.48 seconds
Make Distcheck                PASS      236.43 seconds
Build w/ext ELL - Configure   PASS      8.25 seconds
Build w/ext ELL - Make        PASS      82.57 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    WARNING   482.95 seconds

Details
##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
profiles/audio/media.c:1465:6: warning: 8th function call argument is an uninitialized value
        if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3012:3: warning: Use of memory after it is freed
                release_endpoint(adapter->endpoints->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3015:3: warning: Use of memory after it is freed
                media_player_destroy(adapter->players->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.




---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported
  2022-08-30 21:54 [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported Luiz Augusto von Dentz
  2022-08-30 23:00 ` [BlueZ] " bluez.test.bot
@ 2022-08-31 23:10 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-08-31 23:10 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 30 Aug 2022 14:54:44 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> If adapter don't support ISO sockets the PAC UUIDs shall not be allowed
> to be registered as they depend on ISO sockets to work properly.
> ---
>  profiles/audio/media.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a84aa0e6e5e7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-31 23:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 21:54 [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported Luiz Augusto von Dentz
2022-08-30 23:00 ` [BlueZ] " bluez.test.bot
2022-08-31 23:10 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.