public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: 赵成义 <zhaochengyi@uniontech.com>
To: "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] adapter: Add retry when bonding device returns connection failure
Date: Tue, 2 Jul 2024 11:10:48 +0800	[thread overview]
Message-ID: <tencent_479A3EDC37E92B2C642695B1@qq.com> (raw)
In-Reply-To: <tencent_1A76F7A01B286AA77BEC7DAE@qq.com>

Hi,

> Here is what Ive actually had in mind:
>
> diff --git a/src/adapter.c b/src/adapter.c
> index bb49a1ecad23..f1cc4f2ed25a 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -8363,12 +8363,17 @@ static void bonding_attempt_complete(struct
> btd_adapter *adapter,
>         else
>                 device = btd_adapter_find_device(adapter, bdaddr, addr_type);
>
> -       if (status == MGMT_STATUS_AUTH_FAILED && adapter->pincode_requested) {
> -               /* On faliure, issue a bonding_retry if possible. */
> +       switch (status) {
> +       case MGMT_STATUS_AUTH_FAILED:
> +               if (!adapter->pincode_requested)
> +                       break;
> +       /* fall through */
> +       case MGMT_STATUS_CONNECT_FAILED:
>                 if (device != NULL) {
>                         if (device_bonding_attempt_retry(device) == 0)
>                                 return;
>                 }
> +               break;
>         }
>
>         /* Ignore disconnects during retry. */

Great, I think you are right if kernel does not continue to return MGMT_STATUS_CONNECT_FAILED status.

My idea is to retry only once after returning MGMT_STATUS_CONNECT_FAILED,
it can avoid repeated retry when continuing to return MGMT_STATUS_CONNECT_FAILED.

Cheers,
Chengyi

  parent reply	other threads:[~2024-07-02  3:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 10:12 [PATCH] adapter: Add retry when bonding device returns connection failure Chengyi Zhao
2024-07-01 11:53 ` bluez.test.bot
2024-07-01 16:19 ` [PATCH] " Luiz Augusto von Dentz
     [not found]   ` <tencent_1A76F7A01B286AA77BEC7DAE@qq.com>
2024-07-02  3:10     ` 赵成义 [this message]
2024-07-03  2:48   ` 赵成义
  -- strict thread matches above, loose matches on Subject: below --
2024-06-28 10:13 Chengyi Zhao
2024-06-28 14:00 ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_479A3EDC37E92B2C642695B1@qq.com \
    --to=zhaochengyi@uniontech.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox