Bug 214111 - rtl8761b usb bluetooth doesn't work following reboot until unplug/replug
Summary: rtl8761b usb bluetooth doesn't work following reboot until unplug/replug
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-19 20:35 UTC by bryanhoop
Modified: 2023-10-11 15:35 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.16.16
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Issue with the current firmware version in linux-firmware (8.05 KB, text/plain)
2021-08-26 12:27 UTC, Marco
Details
The output after replacing the firmware with the file from Microsoft Driver update catalog (1.18 KB, text/plain)
2021-08-26 12:28 UTC, Marco
Details

Description bryanhoop 2021-08-19 20:35:04 UTC
I'm not sure if this is the correct place to report this problem, but since the firmware is so new I figure that it is probably a firmware bug.

I have a USB Bluetooth 5.0 dongle using the rtl8761b chipset that was recently added to the kernel. It works fine until I reboot my computer, after which I am unable to activate Bluetooth (from GNOME settings) until I unplug and replug the dongle. Then everything starts working normally.

Logs:

After reboot (dongle not working):

`journalctl -r | grep -i bluetooth`
Aug 19 16:17:21 workstation systemd[1560]: Started Bluetooth OBEX service.
Aug 19 16:17:21 workstation systemd[1560]: Starting Bluetooth OBEX service...
Aug 19 16:16:59 workstation bluetoothd[1237]: Failed to set mode: Failed (0x03)
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc_xq
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc_xq
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/aac
Aug 19 16:16:54 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/ldac
Aug 19 16:16:54 workstation kernel: Bluetooth: RFCOMM ver 1.11
Aug 19 16:16:54 workstation kernel: Bluetooth: RFCOMM socket layer initialized
Aug 19 16:16:54 workstation kernel: Bluetooth: RFCOMM TTY layer initialized
Aug 19 16:16:50 workstation bluetoothd[1237]: Loading LTKs timed out for hci0
Aug 19 16:16:49 workstation NetworkManager[1358]: <info>  [1629404209.5205] Loaded device plugin: NMBluezManager (/usr/lib64/NetworkManager/1.30.6-1.fc34/libnm-device-plugin-bluetooth.so)
Aug 19 16:16:49 workstation kernel: Bluetooth: BNEP socket layer initialized
Aug 19 16:16:49 workstation kernel: Bluetooth: BNEP filters: protocol multicast
Aug 19 16:16:49 workstation kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Aug 19 16:16:49 workstation bluetoothd[1237]: Bluetooth management interface 1.20 initialized
Aug 19 16:16:49 workstation systemd[1]: Reached target Bluetooth Support.
Aug 19 16:16:49 workstation systemd[1]: Started Bluetooth service.
Aug 19 16:16:49 workstation audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=bluetooth comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 19 16:16:49 workstation bluetoothd[1237]: Starting SDP server
Aug 19 16:16:48 workstation bluetoothd[1237]: Bluetooth daemon 5.60
Aug 19 16:16:48 workstation systemd[1]: Starting Bluetooth service...
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: fw version 0x0d99646b
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: cfg_sz 25, total sz 21389
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_config.bin
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_fw.bin
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Aug 19 16:16:38 workstation kernel: Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
Aug 19 16:16:38 workstation kernel: Bluetooth: SCO socket layer initialized
Aug 19 16:16:38 workstation kernel: Bluetooth: L2CAP socket layer initialized
Aug 19 16:16:38 workstation kernel: Bluetooth: HCI socket layer initialized
Aug 19 16:16:38 workstation kernel: Bluetooth: HCI device and connection manager initialized
Aug 19 16:16:38 workstation kernel: Bluetooth: Core ver 2.22
Aug 19 16:16:22 workstation kernel: usb 1-2.4: Product: Bluetooth Radio


`dmesg | grep -i bluetooth`
[    2.020516] usb 1-2.4: Product: Bluetooth Radio
[   28.530291] Bluetooth: Core ver 2.22
[   28.530379] Bluetooth: HCI device and connection manager initialized
[   28.530382] Bluetooth: HCI socket layer initialized
[   28.530384] Bluetooth: L2CAP socket layer initialized
[   28.530389] Bluetooth: SCO socket layer initialized
[   28.585079] Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
[   28.586075] Bluetooth: hci0: RTL: rom_version status=0 version=1
[   28.586079] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_fw.bin
[   28.589119] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_config.bin
[   28.589314] Bluetooth: hci0: RTL: cfg_sz 25, total sz 21389
[   28.704283] Bluetooth: hci0: RTL: fw version 0x0d99646b
[   39.076711] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   39.076713] Bluetooth: BNEP filters: protocol multicast
[   39.076716] Bluetooth: BNEP socket layer initialized
[   44.973247] Bluetooth: RFCOMM TTY layer initialized
[   44.973253] Bluetooth: RFCOMM socket layer initialized
[   44.973332] Bluetooth: RFCOMM ver 1.11

After unplug/replug (dongle working):

`journalctl -r | grep -i bluetooth`
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc_xq
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc_xq
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/aac
Aug 19 16:20:21 workstation bluetoothd[1237]: Endpoint registered: sender=:1.76 path=/MediaEndpoint/A2DPSource/ldac
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: fw version 0x0d99646b
Aug 19 16:20:20 workstation systemd[1]: Reached target Bluetooth Support.
Aug 19 16:20:20 workstation systemd[1560]: Reached target Bluetooth.
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: cfg_sz 25, total sz 21389
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_config.bin
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_fw.bin
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Aug 19 16:20:20 workstation kernel: Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
Aug 19 16:20:20 workstation kernel: usb 1-2.4: Product: Bluetooth Radio
Aug 19 16:20:19 workstation systemd[1]: Stopped target Bluetooth Support.
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSource/sbc_xq
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSink/sbc_xq
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSource/aac
Aug 19 16:20:19 workstation bluetoothd[1237]: Endpoint unregistered: sender=:1.76 path=/MediaEndpoint/A2DPSource/ldac

`dmesg | grep -i bluetooth`
[  248.282331] usb 1-2.4: USB disconnect, device number 4
[  249.115317] usb 1-2.4: new full-speed USB device number 6 using xhci_hcd
[  249.332301] usb 1-2.4: New USB device found, idVendor=0bda, idProduct=8771, bcdDevice= 2.00
[  249.332309] usb 1-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  249.332313] usb 1-2.4: Product: Bluetooth Radio
[  249.332315] usb 1-2.4: Manufacturer: Realtek
[  249.332317] usb 1-2.4: SerialNumber: 00E04C239987
[  249.353595] Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
[  249.354534] Bluetooth: hci0: RTL: rom_version status=0 version=1
[  249.354539] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_fw.bin
[  249.356429] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_config.bin
[  249.356694] Bluetooth: hci0: RTL: cfg_sz 25, total sz 21389
[  249.470211] Bluetooth: hci0: RTL: fw version 0x0d99646b

Other information:

`uname -a`
Linux workstation 5.13.10-200.fc34.x86_64 #1 SMP Fri Aug 13 20:13:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

`dnf info linux-firmware`
Name         : linux-firmware
Version      : 20210716
Release      : 121.fc34
Architecture : noarch
Size         : 195 M
Source       : linux-firmware-20210716-121.fc34.src.rpm
Repository   : @System
From repo    : updates
Summary      : Firmware files used by the Linux kernel
URL          : http://www.kernel.org/
License      : GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
Description  : This package includes firmware files required for some devices to
             : operate.


Please let me know what other information I can provide to help debug.
Comment 1 Marco 2021-08-26 12:11:07 UTC
Can confirm the same issue personally, but for me it's even worse since this firmware doesen't reconnect 9/10 a previously associated device. I've tried an updated version for this adapter (2020/12, from the folder name contained in it) specific for linux from XMPOW:

https://mpow.s3-us-west-1.amazonaws.com/mpow_BH519A_driver+for+Linux.7z

And replaced _fw.bin and _config.bin, but nothing changed.

Then I've found this post on github:

https://gist.github.com/peteristhegreat/b48da772167f86f43decbd34edbd0849

After ordering by date on Microsoft Catalog for "realtek bluetooth", and a dozen downloads, I've finally found a package that contained the firmware version for this rtl8761b, this specific package: https://www.catalog.update.microsoft.com/ScopedViewInline.aspx?updateid=b103336e-5da4-4b03-ad04-7224d591aadd, download link: http://download.windowsupdate.com/d/msdownload/update/driver/drvs/2021/05/ca0e770c-6a5d-4de0-b37a-f4b91cccd8c3_7778831d2b9d721cf94d5a8d8c0676ff1b96c874.cab

This has a date of 26/04/2021, and after extracting rtl8761b_mp_chip_bt40_fw_asic_rom_patch_new.dll and renaming the same file to rtl8761b_fw.bin and replacing the file contained in /lib/firmware/rtl_bt/ and deleting the rtl8761b_config.bin file (AFAIK, Windows packages from Realtek doesn't come with a config file, but besides an error in kernel the _bin is sufficient) my adapter works wonderfully. No issues on reconnecting, no issues after reboot, the adapter works correctly.

Instead of forcing users to randomly download Windows drivers from the web in home to find a working and updated version for this device, can Realtek add the firmware and kept in sync with the Windows version as it does do with the others bluetooth devices supported in kernel? Any way to contact them?

Anyway, for the people who have this issue, try the version linked above.

Marco.
Comment 2 Marco 2021-08-26 12:25:53 UTC
Forgot to upload logs, sorry. This are my previous logs, that are full of random tx trasmission issues, like:

aug 25 09:54:51 Desktop kernel: Bluetooth: hci0: command 0x0c24 tx timeout
aug 25 09:54:54 Desktop kernel: Bluetooth: hci0: command 0x0c52 tx timeout
aug 25 19:45:17 Desktop kernel: Bluetooth: hci0: command 0x0c24 tx timeout
aug 25 20:10:59 Desktop kernel: Bluetooth: hci0: command 0x0c03 tx timeout

aug 24 21:26:58 Desktop kernel: Bluetooth: hci0: command 0x0405 tx timeout
aug 24 21:27:00 Desktop kernel: Bluetooth: hci0: command 0x0c03 tx timeout
aug 24 21:27:08 Desktop kernel: Bluetooth: hci0: HCI reset during shutdown failed
aug 24 21:27:26 Desktop kernel: Bluetooth: hci0: command 0x0405 tx timeout
aug 24 22:18:46 Desktop kernel: Bluetooth: hci0: command 0x0c1a tx timeout

aug 24 14:08:01 Desktop kernel: Bluetooth: hci0: command 0x0c24 tx timeout
aug 24 14:08:03 Desktop kernel: Bluetooth: hci0: command 0x0c52 tx timeout

The HCI reset failed are triggered when I would try to disable and reenable the adapter from KDE desktop, but to no avail before. Now it works perfectly fine and I've no errors anywhere in the dmesg log, I'll also post it.

All the kernel logs are filtered with grep Bluetooth.

Hope to see this issue fixed soon,

Marco.
Comment 3 Marco 2021-08-26 12:27:10 UTC
Created attachment 298483 [details]
Issue with the current firmware version in linux-firmware

Errors that show up by just trying to reconnect a previously associated PS4 controller to the adapter.
Comment 4 Marco 2021-08-26 12:28:24 UTC
Created attachment 298485 [details]
The output after replacing the firmware with the file from Microsoft Driver update catalog
Comment 5 bryanhoop 2021-08-30 16:01:37 UTC
(In reply to Marco from comment #1)
> Can confirm the same issue personally, but for me it's even worse since this
> firmware doesen't reconnect 9/10 a previously associated device. I've tried
> an updated version for this adapter (2020/12, from the folder name contained
> in it) specific for linux from XMPOW:
> 
> https://mpow.s3-us-west-1.amazonaws.com/mpow_BH519A_driver+for+Linux.7z
> 
> And replaced _fw.bin and _config.bin, but nothing changed.
> 
> Then I've found this post on github:
> 
> https://gist.github.com/peteristhegreat/b48da772167f86f43decbd34edbd0849
> 
> After ordering by date on Microsoft Catalog for "realtek bluetooth", and a
> dozen downloads, I've finally found a package that contained the firmware
> version for this rtl8761b, this specific package:
> https://www.catalog.update.microsoft.com/ScopedViewInline.
> aspx?updateid=b103336e-5da4-4b03-ad04-7224d591aadd, download link:
> http://download.windowsupdate.com/d/msdownload/update/driver/drvs/2021/05/
> ca0e770c-6a5d-4de0-b37a-
> f4b91cccd8c3_7778831d2b9d721cf94d5a8d8c0676ff1b96c874.cab
> 
> This has a date of 26/04/2021, and after extracting
> rtl8761b_mp_chip_bt40_fw_asic_rom_patch_new.dll and renaming the same file
> to rtl8761b_fw.bin and replacing the file contained in /lib/firmware/rtl_bt/
> and deleting the rtl8761b_config.bin file (AFAIK, Windows packages from
> Realtek doesn't come with a config file, but besides an error in kernel the
> _bin is sufficient) my adapter works wonderfully. No issues on reconnecting,
> no issues after reboot, the adapter works correctly.
> 
> Instead of forcing users to randomly download Windows drivers from the web
> in home to find a working and updated version for this device, can Realtek
> add the firmware and kept in sync with the Windows version as it does do
> with the others bluetooth devices supported in kernel? Any way to contact
> them?
> 
> Anyway, for the people who have this issue, try the version linked above.
> 
> Marco.


Thanks for these steps Marco. This gives some hope that a fixed firmware will eventually be upstreamed on Linux.

I replaced the fw with the MS version in your link and everything is mostly working now. The major problem I ran into with the updated firmware was audio dropouts using the A2DP AAC codec, but I switched over to SBC-XQ (even higher bandwidth, funnily enough) by editing /usr/share/pipewire/media-session.d/bluez-monitor.conf and it's working flawlessly now.
Comment 6 Marco 2021-08-31 19:26:11 UTC
(In reply to bryanhoop from comment #5)
> ...
>
> Thanks for these steps Marco. This gives some hope that a fixed firmware
> will eventually be upstreamed on Linux.

There is still hope, especially since there is already kernel support for the chipset itself, just the firmware is problematic apparently, and it's even harder since there is no real date timestamp on the firmware itself, so you can't even know if the driver with a higher version number contains an actual updated firmware or not; I hope it does, at least :P 

> I replaced the fw with the MS version in your link and everything is mostly
> working now. The major problem I ran into with the updated firmware was
> audio dropouts using the A2DP AAC codec, but I switched over to SBC-XQ (even
> higher bandwidth, funnily enough) by editing
> /usr/share/pipewire/media-session.d/bluez-monitor.conf and it's working
> flawlessly now.
According to a similar chip from the Realtek site (https://www.realtek.com/en/products/communications-network-ics/item/rtl8763b) mentioned in the github thread linked above, the supported codec are AAC and SBC, so in theory it should work, but AFAIK bluetooth audio on Linux is a little bit of a lottery, unfortunately.

Glad to see it works now :)

I still hope that Realtek will give us proper firmware support, though.
Comment 7 bryanhoop 2021-10-21 11:08:07 UTC
Unfortunately after the update to linux-firmware-20210919-125.fc34.noarch, it appears that the workaround is no longer working. Even with the updated firmware I still have to unplug/replug the dongle after startup to get bluetooth working.
Comment 8 Marco 2021-11-01 13:21:41 UTC
(In reply to bryanhoop from comment #7)
> Unfortunately after the update to linux-firmware-20210919-125.fc34.noarch,
> it appears that the workaround is no longer working. Even with the updated
> firmware I still have to unplug/replug the dongle after startup to get
> bluetooth working.

Recently tested this, and even with the new firmware on my side the workaround still works here, even leaving the old config in place. Don't really know why it's not working for you anymore.
Comment 9 Marco 2022-03-21 16:46:06 UTC
(In reply to bryanhoop from comment #7)
> Unfortunately after the update to linux-firmware-20210919-125.fc34.noarch,
> it appears that the workaround is no longer working. Even with the updated
> firmware I still have to unplug/replug the dongle after startup to get
> bluetooth working.

Just realized right now, if you are using Arch, the firmware seems to be packed in a xz archive on my system. It was still working here because for some reason the .bin probably is getting loaded before the .bin.xz file from the distribution.

By the way, I've seen that a Realtek engineer has updated the firmware file at the end of last year, as of https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/rtl_bt/rtl8761bu_fw.bin?id=45dc5f0b8e2f2d43312d22511cb26658b9ee2c80, but the bug with that firmware still remains. I need to force disable and enable the device.

I'll probably just get an adapter for a mPCIEx or M2 laptop to PCIEx and install an already available Intel module that I got flotaing around at this point, I doubt that this will ever be fixed on this hardware, unfortunately.

Marco.
Comment 10 Marco 2023-10-11 15:09:50 UTC
With the latest changes and the default firmware it literally doesn't work. Kernel loads a firmware, but the adapter is undetected from the OS. This will never be fixed at this point. Kernel 6.5.5.

Note You need to log in before you can comment on or make changes to this bug.