All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Check flags are supported
@ 2022-08-15 23:20 Luiz Augusto von Dentz
  2022-08-16  4:39 ` [BlueZ] " bluez.test.bot
  2022-08-16 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-15 23:20 UTC (permalink / raw)
  To: linux-bluetooth

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

This makes sure the flags are supported before attempting to set it.
---
 src/adapter.c | 4 +++-
 src/device.c  | 5 +++++
 src/device.h  | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 3fa3018093b3..d33fc9bd661c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -5428,10 +5428,12 @@ void adapter_set_device_flags(struct btd_adapter *adapter,
 				mgmt_request_func_t func, void *user_data)
 {
 	struct mgmt_cp_set_device_flags cp;
+	uint32_t supported = btd_device_get_supported_flags(device);
 	const bdaddr_t *bdaddr;
 	uint8_t bdaddr_type;
 
-	if (!btd_has_kernel_features(KERNEL_CONN_CONTROL))
+	if (!btd_has_kernel_features(KERNEL_CONN_CONTROL) ||
+				(supported | flags) != supported)
 		return;
 
 	bdaddr = device_get_address(device);
diff --git a/src/device.c b/src/device.c
index bc99420228d2..698c668b5420 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6821,6 +6821,11 @@ uint32_t btd_device_get_current_flags(struct btd_device *dev)
 	return dev->current_flags;
 }
 
+uint32_t btd_device_get_supported_flags(struct btd_device *dev)
+{
+	return dev->supported_flags;
+}
+
 /* This event is sent immediately after add device on all mgmt sockets.
  * Afterwards, it is only sent to mgmt sockets other than the one which called
  * set_device_flags.
diff --git a/src/device.h b/src/device.h
index cc474bd889ec..9e81fda9e948 100644
--- a/src/device.h
+++ b/src/device.h
@@ -177,6 +177,7 @@ int device_discover_services(struct btd_device *device);
 int btd_device_connect_services(struct btd_device *dev, GSList *services);
 
 uint32_t btd_device_get_current_flags(struct btd_device *dev);
+uint32_t btd_device_get_supported_flags(struct btd_device *dev);
 void btd_device_flags_changed(struct btd_device *dev, uint32_t supported_flags,
 			      uint32_t current_flags);
 
-- 
2.37.2


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

* RE: [BlueZ] adapter: Check flags are supported
  2022-08-15 23:20 [PATCH BlueZ] adapter: Check flags are supported Luiz Augusto von Dentz
@ 2022-08-16  4:39 ` bluez.test.bot
  2022-08-16 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-08-16  4:39 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1049 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=667831

---Test result---

Test Summary:
CheckPatch                    PASS      1.26 seconds
GitLint                       PASS      0.79 seconds
Prep - Setup ELL              PASS      33.08 seconds
Build - Prep                  PASS      0.89 seconds
Build - Configure             PASS      11.00 seconds
Build - Make                  PASS      991.11 seconds
Make Check                    PASS      12.79 seconds
Make Check w/Valgrind         PASS      345.61 seconds
Make Distcheck                PASS      294.13 seconds
Build w/ext ELL - Configure   PASS      10.60 seconds
Build w/ext ELL - Make        PASS      97.83 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      738.27 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] adapter: Check flags are supported
  2022-08-15 23:20 [PATCH BlueZ] adapter: Check flags are supported Luiz Augusto von Dentz
  2022-08-16  4:39 ` [BlueZ] " bluez.test.bot
@ 2022-08-16 23:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-08-16 23:20 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 Mon, 15 Aug 2022 16:20:06 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This makes sure the flags are supported before attempting to set it.
> ---
>  src/adapter.c | 4 +++-
>  src/device.c  | 5 +++++
>  src/device.h  | 1 +
>  3 files changed, 9 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [BlueZ] adapter: Check flags are supported
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c47730b2d563

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-16 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 23:20 [PATCH BlueZ] adapter: Check flags are supported Luiz Augusto von Dentz
2022-08-16  4:39 ` [BlueZ] " bluez.test.bot
2022-08-16 23:20 ` [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.