Bluetooth issues with hci_sync after v6.4+

From: Emil Kronborg
Date: Wed Feb 21 2024 - 05:45:17 EST


Hi,

After updating Linux on an i.MX28 board, I encountered errors related to
Bluetooth:

$ journalctl -p3 -xb
(...)
Feb 06 14:05:49 hp1 bluetoothd[183]: /usr/src/debug/bluez5/5.69-r0/src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv Monitors: Failed (0x03)
Feb 06 14:05:50 hp1 bluetoothd[183]: Failed to clear UUIDs: Failed (0x03)
Feb 06 14:05:50 hp1 bluetoothd[183]: Failed to add UUID: Failed (0x03)
Feb 06 14:05:50 hp1 bluetoothd[183]: Failed to add UUID: Failed (0x03)
Feb 06 14:05:50 hp1 bluetoothd[183]: Failed to add UUID: Failed (0x03)

I found that [1] encountered similar errors, which were addressed in
95b701543305 ("Bluetooth: btusb: Fix bluetooth on Intel Macbook 2014").
However, the board I am working with uses the Bluetooth HCI UART driver
instead of the USB driver. After bisecting, I identified the offending
commit as d883a4669a1d ("Bluetooth: hci_sync: Only allow
hci_cmd_sync_queue if running"). While reverting the commit would
resolve my issues, I am uncertain if this problem is unique to my setup,
as I have not come across other reports for ARM boards or the Bluetooth
HCI UART driver. Do you have any ideas how to solve this? Any pointers
are appreciated.

Below is (some) of the log when running the daemon in debug mode. I only
included part of it to not clutter the mail. Let me know if you want the
full log instead.

$ /usr/libexec/bluetooth/bluetoothd -n -d
(...)
bluetoothd[384]: /usr/src/debug/bluez5/5.69-r0/src/shared/mgmt.c:send_request() [0x0000] command 0x0053
bluetoothd[384]: /usr/src/debug/bluez5/5.69-r0/src/shared/mgmt.c:can_read_data() [0x0000] command 0x53 status: 0x03
bluetoothd[384]: /usr/src/debug/bluez5/5.69-r0/src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv Monitors: Failed (0x03)
bluetoothd[384]: /usr/src/debug/bluez5/5.69-r0/src/shared/mgmt.c:send_request() write failed: Network is down
bluetoothd[384]: Failed to clear UUIDs: Failed (0x03)
bluetoothd[384]: /usr/src/debug/bluez5/5.69-r0/src/shared/mgmt.c:send_request() write failed: Network is down
bluetoothd[384]: Failed to add UUID: Failed (0x03)

And here is some information about the device. Note that I anonymized
the MAC address.

$ hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 1021:6 SCO MTU: 180:4
UP RUNNING
RX bytes:5761 acl:0 sco:0 events:494 errors:0
TX bytes:70546 acl:0 sco:0 commands:494 errors:0
Features: 0xff 0xfe 0x2d 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'BlueZ 5.69'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: 4.2 (0x8) Revision: 0x0
LMP Version: 4.2 (0x8) Subversion: 0xac0f
Manufacturer: Texas Instruments Inc. (13)

Let me know if I can provide more information.

[1]:
https://bugs.archlinux.org/task/78980.html

--
Emil Kronborg