linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] client/mgmt: Fix registering pairing callbacks
@ 2023-10-03 21:14 Luiz Augusto von Dentz
  2023-10-03 22:34 ` [BlueZ] " bluez.test.bot
  2023-10-03 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2023-10-03 21:14 UTC (permalink / raw)
  To: linux-bluetooth

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

Don't register pairing callbacks until mgmt.pair is called otherwise it
may take over the role of pairing agent when bluetoothctl agent is in
use.
---
 client/mgmt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/client/mgmt.c b/client/mgmt.c
index c056d018a9da..947d8fcd5556 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -3056,6 +3056,18 @@ static void pair_rsp(uint8_t status, uint16_t len, const void *param,
 	bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void register_pair_callbacks(struct mgmt *mgmt, uint16_t index)
+{
+	mgmt_register(mgmt, MGMT_EV_PIN_CODE_REQUEST, index, request_pin,
+								mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_USER_CONFIRM_REQUEST, index, user_confirm,
+								mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_USER_PASSKEY_REQUEST, index,
+						request_passkey, mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_PASSKEY_NOTIFY, index,
+						passkey_notify, mgmt, NULL);
+}
+
 static struct option pair_options[] = {
 	{ "help",	0, 0, 'h' },
 	{ "capability",	1, 0, 'c' },
@@ -3105,6 +3117,8 @@ static void cmd_pair(int argc, char **argv)
 	if (index == MGMT_INDEX_NONE)
 		index = 0;
 
+	register_pair_callbacks(mgmt, index);
+
 	memset(&cp, 0, sizeof(cp));
 	str2ba(argv[0], &cp.addr.bdaddr);
 	cp.addr.type = type;
@@ -5780,14 +5794,6 @@ static void register_mgmt_callbacks(struct mgmt *mgmt, uint16_t index)
 					local_name_changed, NULL, NULL);
 	mgmt_register(mgmt, MGMT_EV_DEVICE_FOUND, index, device_found,
 								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_PIN_CODE_REQUEST, index, request_pin,
-								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_USER_CONFIRM_REQUEST, index, user_confirm,
-								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_USER_PASSKEY_REQUEST, index,
-						request_passkey, mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_PASSKEY_NOTIFY, index,
-						passkey_notify, mgmt, NULL);
 	mgmt_register(mgmt, MGMT_EV_UNCONF_INDEX_ADDED, index,
 					unconf_index_added, NULL, NULL);
 	mgmt_register(mgmt, MGMT_EV_UNCONF_INDEX_REMOVED, index,
-- 
2.41.0


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

* RE: [BlueZ] client/mgmt: Fix registering pairing callbacks
  2023-10-03 21:14 [PATCH BlueZ] client/mgmt: Fix registering pairing callbacks Luiz Augusto von Dentz
@ 2023-10-03 22:34 ` bluez.test.bot
  2023-10-03 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-10-03 22:34 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.38 seconds
GitLint                       PASS      0.26 seconds
BuildEll                      PASS      27.84 seconds
BluezMake                     PASS      783.27 seconds
MakeCheck                     PASS      12.19 seconds
MakeDistcheck                 PASS      160.83 seconds
CheckValgrind                 PASS      255.32 seconds
CheckSmatch                   PASS      348.54 seconds
bluezmakeextell               PASS      106.02 seconds
IncrementalBuild              PASS      659.30 seconds
ScanBuild                     PASS      1041.71 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] client/mgmt: Fix registering pairing callbacks
  2023-10-03 21:14 [PATCH BlueZ] client/mgmt: Fix registering pairing callbacks Luiz Augusto von Dentz
  2023-10-03 22:34 ` [BlueZ] " bluez.test.bot
@ 2023-10-03 23:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-10-03 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 Tue,  3 Oct 2023 14:14:42 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Don't register pairing callbacks until mgmt.pair is called otherwise it
> may take over the role of pairing agent when bluetoothctl agent is in
> use.
> ---
>  client/mgmt.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)

Here is the summary with links:
  - [BlueZ] client/mgmt: Fix registering pairing callbacks
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9741e47aebcd

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:[~2023-10-03 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 21:14 [PATCH BlueZ] client/mgmt: Fix registering pairing callbacks Luiz Augusto von Dentz
2023-10-03 22:34 ` [BlueZ] " bluez.test.bot
2023-10-03 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).