public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] adapter: Add retry when bonding device returns connection failure
@ 2024-06-28 10:13 Chengyi Zhao
  2024-06-28 12:45 ` bluez.test.bot
  2024-06-28 14:00 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 4+ messages in thread
From: Chengyi Zhao @ 2024-06-28 10:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Chengyi Zhao

When a user initiates pairing with a BLE Bluetooth mouse,
MGMT_STATUS_CONNECT_FAILED(0x04) is returned with a low
probability, resulting in pairing failure. To improve
user experience, retry bonding is performed when
MGMT_STATUS_CONNECT_FAILED is returned.

log:
bluetoothd[1539]: src/adapter.c:pair_device_complete() Connect Failed (0x04)
bluetoothd[1539]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr DD:EC:0F:57:A9:2E type 2 status 0x4
bluetoothd[1539]: src/device.c:device_bonding_complete() bonding 0x5591f87230 status 0x04
bluetoothd[1539]: src/device.c:btd_device_set_temporary() temporary 1
bluetoothd[1539]: src/device.c:device_bonding_failed() status 4

HCI package:
Frame 2969: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
Bluetooth
Bluetooth HCI H4
Bluetooth HCI Event - Disconnect Complete
    Event Code: Disconnect Complete (0x05)
    Parameter Total Length: 4
    Status: Success (0x00)
    Connection Handle: 0x0040
    Reason: Connection Failed to be Established (0x3e)
---
 src/adapter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index bdc5bf920..ca5eb077c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -8367,6 +8367,16 @@ static void bonding_attempt_complete(struct btd_adapter *adapter,
 		}
 	}
 
+	if (status == MGMT_STATUS_CONNECT_FAILED) {
+		if (device != NULL) {
+
+			DBG("status is 0x%x, retry it.", status);
+
+			if (device_bonding_attempt_retry(device) == 0)
+				return;
+		}
+	}
+
 	/* Ignore disconnects during retry. */
 	if (status == MGMT_STATUS_DISCONNECTED &&
 					device && device_is_retrying(device))
-- 
2.20.1


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

* RE: adapter: Add retry when bonding device returns connection failure
  2024-06-28 10:13 [PATCH] adapter: Add retry when bonding device returns connection failure Chengyi Zhao
@ 2024-06-28 12:45 ` bluez.test.bot
  2024-06-28 14:00 ` [PATCH] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-06-28 12:45 UTC (permalink / raw)
  To: linux-bluetooth, zhaochengyi

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

---Test result---

Test Summary:
CheckPatch                    FAIL      0.63 seconds
GitLint                       FAIL      0.58 seconds
BuildEll                      PASS      28.40 seconds
BluezMake                     PASS      2669.45 seconds
MakeCheck                     PASS      14.22 seconds
MakeDistcheck                 PASS      201.46 seconds
CheckValgrind                 PASS      287.73 seconds
CheckSmatch                   PASS      390.07 seconds
bluezmakeextell               PASS      140.54 seconds
IncrementalBuild              PASS      2641.40 seconds
ScanBuild                     PASS      1202.42 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
adapter: Add retry when bonding device returns connection failure
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#61: 
bluetoothd[1539]: src/adapter.c:pair_device_complete() Connect Failed (0x04)

/github/workspace/src/src/13715936.patch total: 0 errors, 1 warnings, 16 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13715936.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
adapter: Add retry when bonding device returns connection failure

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
11: B1 Line exceeds max length (106>80): "bluetoothd[1539]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr DD:EC:0F:57:A9:2E type 2 status 0x4"
12: B1 Line exceeds max length (89>80): "bluetoothd[1539]: src/device.c:device_bonding_complete() bonding 0x5591f87230 status 0x04"


---
Regards,
Linux Bluetooth


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

* Re: [PATCH] adapter: Add retry when bonding device returns connection failure
  2024-06-28 10:13 [PATCH] adapter: Add retry when bonding device returns connection failure Chengyi Zhao
  2024-06-28 12:45 ` bluez.test.bot
@ 2024-06-28 14:00 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-06-28 14:00 UTC (permalink / raw)
  To: Chengyi Zhao; +Cc: linux-bluetooth

Hi Chengyi,

On Fri, Jun 28, 2024 at 6:15 AM Chengyi Zhao <zhaochengyi@uniontech.com> wrote:
>
> When a user initiates pairing with a BLE Bluetooth mouse,
> MGMT_STATUS_CONNECT_FAILED(0x04) is returned with a low
> probability, resulting in pairing failure. To improve
> user experience, retry bonding is performed when
> MGMT_STATUS_CONNECT_FAILED is returned.
>
> log:
> bluetoothd[1539]: src/adapter.c:pair_device_complete() Connect Failed (0x04)
> bluetoothd[1539]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr DD:EC:0F:57:A9:2E type 2 status 0x4
> bluetoothd[1539]: src/device.c:device_bonding_complete() bonding 0x5591f87230 status 0x04
> bluetoothd[1539]: src/device.c:btd_device_set_temporary() temporary 1
> bluetoothd[1539]: src/device.c:device_bonding_failed() status 4
>
> HCI package:
> Frame 2969: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
> Bluetooth
> Bluetooth HCI H4
> Bluetooth HCI Event - Disconnect Complete
>     Event Code: Disconnect Complete (0x05)
>     Parameter Total Length: 4
>     Status: Success (0x00)
>     Connection Handle: 0x0040
>     Reason: Connection Failed to be Established (0x3e)
> ---
>  src/adapter.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index bdc5bf920..ca5eb077c 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -8367,6 +8367,16 @@ static void bonding_attempt_complete(struct btd_adapter *adapter,
>                 }
>         }
>
> +       if (status == MGMT_STATUS_CONNECT_FAILED) {
> +               if (device != NULL) {
> +
> +                       DBG("status is 0x%x, retry it.", status);
> +
> +                       if (device_bonding_attempt_retry(device) == 0)
> +                               return;
> +               }
> +       }

There is already an if statement to handle retrying, not sure why you
didn't modify it?

>         /* Ignore disconnects during retry. */
>         if (status == MGMT_STATUS_DISCONNECTED &&
>                                         device && device_is_retrying(device))
> --
> 2.20.1
>
>


-- 
Luiz Augusto von Dentz

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

* RE: adapter: Add retry when bonding device returns connection failure
  2024-07-01 10:12 Chengyi Zhao
@ 2024-07-01 11:53 ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-07-01 11:53 UTC (permalink / raw)
  To: linux-bluetooth, zhaochengyi

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.34 seconds
GitLint                       PASS      0.23 seconds
BuildEll                      PASS      26.68 seconds
BluezMake                     PASS      1941.59 seconds
MakeCheck                     PASS      15.25 seconds
MakeDistcheck                 PASS      186.76 seconds
CheckValgrind                 PASS      264.28 seconds
CheckSmatch                   PASS      369.14 seconds
bluezmakeextell               PASS      125.03 seconds
IncrementalBuild              PASS      1689.38 seconds
ScanBuild                     PASS      1091.47 seconds



---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2024-07-01 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 10:13 [PATCH] adapter: Add retry when bonding device returns connection failure Chengyi Zhao
2024-06-28 12:45 ` bluez.test.bot
2024-06-28 14:00 ` [PATCH] " Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2024-07-01 10:12 Chengyi Zhao
2024-07-01 11:53 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox