All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] core/device: Handle Just-Works auto-accept
@ 2020-03-28  0:33 Sonny Sasaka
  2020-03-31  6:30 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-28  0:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sonny Sasaka

The kernel starts to always request confirmation to BlueZ daemon for
Just-Works pairing. In this patch the daemon does auto-accept if the
client has clearly indicated a pairing intent by calling the Pair()
D-Bus API.
---
 src/device.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 69f98e488..db14cc129 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device *device, uint8_t type,
 
 	auth->passkey = passkey;
 
-	if (confirm_hint)
+	if (confirm_hint) {
+		if (device->bonding != NULL) {
+			/* We know the client has indicated the intent to pair
+			 * with the peer device, so we can auto-accept. */
+			btd_adapter_confirm_reply(device->adapter,
+						  &device->bdaddr,
+						  type, TRUE);
+			return 0;
+		}
+
 		err = agent_request_authorization(auth->agent, device,
 						confirm_cb, auth, NULL);
-	else
+	} else {
 		err = agent_request_confirmation(auth->agent, device, passkey,
 						confirm_cb, auth, NULL);
+	}
 
 	if (err < 0) {
 		if (err == -EINPROGRESS) {
-- 
2.17.1


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

* Re: [PATCH] core/device: Handle Just-Works auto-accept
  2020-03-28  0:33 [PATCH] core/device: Handle Just-Works auto-accept Sonny Sasaka
@ 2020-03-31  6:30 ` Luiz Augusto von Dentz
  2020-03-31 17:22   ` Sonny Sasaka
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2020-03-31  6:30 UTC (permalink / raw)
  To: Sonny Sasaka; +Cc: linux-bluetooth

Hi Sonny,

On Fri, Mar 27, 2020 at 5:36 PM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
>
> The kernel starts to always request confirmation to BlueZ daemon for
> Just-Works pairing. In this patch the daemon does auto-accept if the
> client has clearly indicated a pairing intent by calling the Pair()
> D-Bus API.
> ---
>  src/device.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index 69f98e488..db14cc129 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device *device, uint8_t type,
>
>         auth->passkey = passkey;
>
> -       if (confirm_hint)
> +       if (confirm_hint) {
> +               if (device->bonding != NULL) {
> +                       /* We know the client has indicated the intent to pair
> +                        * with the peer device, so we can auto-accept. */
> +                       btd_adapter_confirm_reply(device->adapter,
> +                                                 &device->bdaddr,
> +                                                 type, TRUE);
> +                       return 0;
> +               }
> +
>                 err = agent_request_authorization(auth->agent, device,
>                                                 confirm_cb, auth, NULL);
> -       else
> +       } else {
>                 err = agent_request_confirmation(auth->agent, device, passkey,
>                                                 confirm_cb, auth, NULL);
> +       }
>
>         if (err < 0) {
>                 if (err == -EINPROGRESS) {
> --
> 2.17.1
>
Applied.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] core/device: Handle Just-Works auto-accept
  2020-03-31  6:30 ` Luiz Augusto von Dentz
@ 2020-03-31 17:22   ` Sonny Sasaka
  0 siblings, 0 replies; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-31 17:22 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Thanks, Luiz.

On Mon, Mar 30, 2020 at 11:30 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Sonny,
>
> On Fri, Mar 27, 2020 at 5:36 PM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
> >
> > The kernel starts to always request confirmation to BlueZ daemon for
> > Just-Works pairing. In this patch the daemon does auto-accept if the
> > client has clearly indicated a pairing intent by calling the Pair()
> > D-Bus API.
> > ---
> >  src/device.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/device.c b/src/device.c
> > index 69f98e488..db14cc129 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device *device, uint8_t type,
> >
> >         auth->passkey = passkey;
> >
> > -       if (confirm_hint)
> > +       if (confirm_hint) {
> > +               if (device->bonding != NULL) {
> > +                       /* We know the client has indicated the intent to pair
> > +                        * with the peer device, so we can auto-accept. */
> > +                       btd_adapter_confirm_reply(device->adapter,
> > +                                                 &device->bdaddr,
> > +                                                 type, TRUE);
> > +                       return 0;
> > +               }
> > +
> >                 err = agent_request_authorization(auth->agent, device,
> >                                                 confirm_cb, auth, NULL);
> > -       else
> > +       } else {
> >                 err = agent_request_confirmation(auth->agent, device, passkey,
> >                                                 confirm_cb, auth, NULL);
> > +       }
> >
> >         if (err < 0) {
> >                 if (err == -EINPROGRESS) {
> > --
> > 2.17.1
> >
> Applied.
>
> --
> Luiz Augusto von Dentz

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

* [PATCH] core/device: Handle Just-Works auto-accept
@ 2020-03-28  0:12 Sonny Sasaka
  0 siblings, 0 replies; 4+ messages in thread
From: Sonny Sasaka @ 2020-03-28  0:12 UTC (permalink / raw)
  To: BlueZ

The kernel starts to always request confirmation to BlueZ daemon for
Just-Works pairing. In this patch the daemon does auto-accept if the
client has clearly indicated a pairing intent by calling the Pair()
D-Bus API.
---
 src/device.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 69f98e488..db14cc129 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device
*device, uint8_t type,

  auth->passkey = passkey;

- if (confirm_hint)
+ if (confirm_hint) {
+ if (device->bonding != NULL) {
+ /* We know the client has indicated the intent to pair
+ * with the peer device, so we can auto-accept. */
+ btd_adapter_confirm_reply(device->adapter,
+  &device->bdaddr,
+  type, TRUE);
+ return 0;
+ }
+
  err = agent_request_authorization(auth->agent, device,
  confirm_cb, auth, NULL);
- else
+ } else {
  err = agent_request_confirmation(auth->agent, device, passkey,
  confirm_cb, auth, NULL);
+ }

  if (err < 0) {
  if (err == -EINPROGRESS) {
-- 
2.17.1

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

end of thread, other threads:[~2020-03-31 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28  0:33 [PATCH] core/device: Handle Just-Works auto-accept Sonny Sasaka
2020-03-31  6:30 ` Luiz Augusto von Dentz
2020-03-31 17:22   ` Sonny Sasaka
  -- strict thread matches above, loose matches on Subject: below --
2020-03-28  0:12 Sonny Sasaka

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.