Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery
@ 2026-07-14  3:10 Ameen Al-Asady
  2026-07-14  3:10 ` [PATCH v2 2/2] Bluetooth: hci_sync: Skip MSFT/AOSP init when controller init failed Ameen Al-Asady
  2026-07-14  4:07 ` [v2,1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery bluez.test.bot
  0 siblings, 2 replies; 3+ messages in thread
From: Ameen Al-Asady @ 2026-07-14  3:10 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Paul Menzel,
	Ameen Al-Asady

When the firmware download errors out because the controller is
running an operational image whose version does not match the
firmware file on disk, btintel_reset_to_bootloader() sends the Intel
Reset vendor command to force the controller back into bootloader
mode and retry the download. This is the normal upgrade path after a
linux-firmware update followed by a warm reboot, since the
operational image survives in controller RAM. In the log below the
controller is still running build 81755 (2024.33) while
intel/ibt-0041-0041.sfi on disk contains build 82122 (2026.5).

The controller acts on Intel Reset by resetting and re-enumerating
on the bus. This can happen before the command complete event is
delivered, in which case __hci_cmd_sync() returns -ENODEV and the
driver logs a misleading error even though recovery is working:

  Bluetooth: hci0: Firmware timestamp 2024.33 buildtype 1 build 81755
  Bluetooth: hci0: Found device firmware: intel/ibt-0041-0041.sfi
  usb 1-6: USB disconnect, device number 4
  Bluetooth: hci0: FW download error recovery failed (-19)
  usb 1-6: new full-speed USB device number 5 using xhci_hcd
  ...
  Bluetooth: hci0: Firmware loaded in 2827613 usecs
  Bluetooth: hci0: Firmware timestamp 2026.5 buildtype 1 build 82122

Treat -ENODEV as the expected outcome of the reset and keep the
error message for genuine failures.

Tested on an Intel AX210 (USB 8087:0032) on a 7.1.3 kernel by
rebinding btusb with a non-matching firmware file on disk, in both
the downgrade and upgrade direction. Both runs took the -ENODEV
path, logged the info message instead of the error and completed
the download after re-enumeration.

Signed-off-by: Ameen Al-Asady <ameenaladdin@gmail.com>
---
v2: reword commit message, add firmware versions and tested system
    (Paul Menzel)

 drivers/bluetooth/btintel.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 5e9cac090..472542bff 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1363,12 +1363,22 @@ static void btintel_reset_to_bootloader(struct hci_dev *hdev)
 	skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params),
 			     &params, HCI_INIT_TIMEOUT);
 	if (IS_ERR(skb)) {
-		bt_dev_err(hdev, "FW download error recovery failed (%ld)",
-			   PTR_ERR(skb));
-		return;
+		/* The controller acts on Intel Reset by resetting and
+		 * re-enumerating on the bus, which can happen before the
+		 * command complete event is delivered. The resulting
+		 * -ENODEV means the reset took effect, not that recovery
+		 * failed.
+		 */
+		if (PTR_ERR(skb) != -ENODEV) {
+			bt_dev_err(hdev,
+				   "FW download error recovery failed (%ld)",
+				   PTR_ERR(skb));
+			return;
+		}
+	} else {
+		kfree_skb(skb);
 	}
 	bt_dev_info(hdev, "Intel reset sent to retry FW download");
-	kfree_skb(skb);
 
 	/* Current Intel BT controllers(ThP/JfP) hold the USB reset
 	 * lines for 2ms when it receives Intel Reset in bootloader mode.

base-commit: eab19cb7618e5c50fd1f8c1efdc4e66e16575975
-- 
2.55.0


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

end of thread, other threads:[~2026-07-14  4:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14  3:10 [PATCH v2 1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery Ameen Al-Asady
2026-07-14  3:10 ` [PATCH v2 2/2] Bluetooth: hci_sync: Skip MSFT/AOSP init when controller init failed Ameen Al-Asady
2026-07-14  4:07 ` [v2,1/2] Bluetooth: btintel: Fix spurious error on FW download error recovery 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