Linux-Bluetooth Archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure
@ 2024-04-12  8:41 Hao Qin
  2024-04-12  9:32 ` bluez.test.bot
  2024-04-16 14:53 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Qin @ 2024-04-12  8:41 UTC (permalink / raw
  To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
  Cc: Sean Wang, Deren Wu, Aaron Hou, Chris Lu, Steve Lee,
	linux-bluetooth, linux-kernel, linux-mediatek, Hao Qin

Add usb reset to recover BT device from a firmware setup failure,
it will restore the device to its original state and attempt setup
firmware again.

Signed-off-by: Hao Qin <hao.qin@mediatek.com>
---
 drivers/bluetooth/btusb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4c0cc13adb47..c5aab361795e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3160,6 +3160,9 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
 						btusb_mtk_hci_wmt_sync);
 		if (err < 0) {
 			bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
+			btusb_stop_traffic(data);
+			usb_kill_anchored_urbs(&data->tx_anchor);
+			usb_queue_reset_device(data->intf);
 			return err;
 		}
 
-- 
2.18.0


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

* RE: Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure
  2024-04-12  8:41 [PATCH] Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure Hao Qin
@ 2024-04-12  9:32 ` bluez.test.bot
  2024-04-16 14:53 ` [PATCH] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-04-12  9:32 UTC (permalink / raw
  To: linux-bluetooth, hao.qin

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.64 seconds
GitLint                       PASS      0.31 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      29.48 seconds
CheckAllWarning               PASS      34.55 seconds
CheckSparse                   PASS      37.69 seconds
CheckSmatch                   FAIL      35.40 seconds
BuildKernel32                 PASS      28.54 seconds
TestRunnerSetup               PASS      512.68 seconds
TestRunner_l2cap-tester       PASS      18.44 seconds
TestRunner_iso-tester         PASS      28.77 seconds
TestRunner_bnep-tester        PASS      4.85 seconds
TestRunner_mgmt-tester        PASS      109.71 seconds
TestRunner_rfcomm-tester      PASS      7.43 seconds
TestRunner_sco-tester         PASS      15.11 seconds
TestRunner_ioctl-tester       PASS      7.75 seconds
TestRunner_mesh-tester        FAIL      6.00 seconds
TestRunner_smp-tester         PASS      6.90 seconds
TestRunner_userchan-tester    PASS      5.06 seconds
IncrementalBuild              PASS      27.50 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 2                               Failed       0.094 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure
  2024-04-12  8:41 [PATCH] Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure Hao Qin
  2024-04-12  9:32 ` bluez.test.bot
@ 2024-04-16 14:53 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-16 14:53 UTC (permalink / raw
  To: Hao Qin
  Cc: Marcel Holtmann, Johan Hedberg, Sean Wang, Deren Wu, Aaron Hou,
	Chris Lu, Steve Lee, linux-bluetooth, linux-kernel,
	linux-mediatek

Hi,

On Fri, Apr 12, 2024 at 4:43 AM Hao Qin <hao.qin@mediatek.com> wrote:
>
> Add usb reset to recover BT device from a firmware setup failure,
> it will restore the device to its original state and attempt setup
> firmware again.
>
> Signed-off-by: Hao Qin <hao.qin@mediatek.com>
> ---
>  drivers/bluetooth/btusb.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 4c0cc13adb47..c5aab361795e 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3160,6 +3160,9 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
>                                                 btusb_mtk_hci_wmt_sync);
>                 if (err < 0) {
>                         bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
> +                       btusb_stop_traffic(data);
> +                       usb_kill_anchored_urbs(&data->tx_anchor);
> +                       usb_queue_reset_device(data->intf);

What if this was already caused by a reset? Wouldn't that create a
loop resetting the device over and over again?

>                         return err;
>                 }
>
> --
> 2.18.0
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2024-04-16 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12  8:41 [PATCH] Bluetooth: btusb: mediatek: Add usb reset for firmware setup failure Hao Qin
2024-04-12  9:32 ` bluez.test.bot
2024-04-16 14:53 ` [PATCH] " Luiz Augusto von Dentz

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 read-only IMAP folder(s) and NNTP newsgroup(s).