Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth not working [0bda:b00a] #19

Closed
wahsot opened this issue Jan 2, 2019 · 35 comments
Closed

Bluetooth not working [0bda:b00a] #19

wahsot opened this issue Jan 2, 2019 · 35 comments

Comments

@wahsot
Copy link

wahsot commented Jan 2, 2019

Running Archlinux on HP 4NZ54PA, with your AUR package rtl8821ce-dkms-git.

$ rfkill
ID TYPE      DEVICE      SOFT      HARD
 0 bluetooth hci0   unblocked unblocked
 1 wlan      phy0   unblocked unblocked

The MAC address is all zeroes.

$ hciconfig -a
hci0:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN 
        RX bytes:14 acl:0 sco:0 events:1 errors:0
        TX bytes:3 acl:0 sco:0 commands:1 errors:0
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DH1 HV1 
        Link policy: 
        Link mode: SLAVE ACCEPT 

Some related kernel messages.

[    0.000000] Linux version 4.19.12-arch1-1-ARCH (builduser@heftig-21538) (gcc version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Fri Dec 21 13:56:54 UTC 2018
...
[    4.230415] usb 3-2.3: new full-speed USB device number 4 using xhci_hcd
[    4.340266] usb 3-2.3: New USB device found, idVendor=0bda, idProduct=b00a, bcdDevice= 1.10
[    4.340269] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.340271] usb 3-2.3: Product: Bluetooth Radio 
[    4.340272] usb 3-2.3: Manufacturer: Realtek 
[    4.340273] usb 3-2.3: SerialNumber: 00e04c000001
...
[    9.955545] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    9.983859] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    9.985375] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    9.985380] cfg80211: failed to load regulatory.db
[   10.018686] 8821ce: loading out-of-tree module taints kernel.
[   10.034138] 8821ce: module verification failed: signature and/or required key missing - tainting kernel
[   10.050022] videodev: Linux video capture interface: v2.00
[   10.070445] kvm: disabled by bios
[   10.073367] RTW: module init start
[   10.073369] RTW: rtl8821ce v5.2.5_1.26055.20180108
[   10.073370] RTW: build time: Dec 29 2018 20:00:46
[   10.073372] RTW: rtl8821ce BT-Coex version = COEX20170310-1212
[   10.073652] RTW: [HALMAC]13348M
[   10.073653] RTW: [HALMAC]HALMAC_MAJOR_VER = 1
[   10.073654] RTW: [HALMAC]HALMAC_PROTOTYPE_VER = 3
[   10.073655] RTW: [HALMAC]HALMAC_MINOR_VER = 6
[   10.073656] RTW: [HALMAC]HALMAC_PATCH_VER = 2
[   10.073664] RTW: [HALMAC]13359M
[   10.073665] RTW: [HALMAC]HALMAC_MAJOR_VER_88XX = 1
[   10.073665] RTW: [HALMAC]HALMAC_PROTOTYPE_88XX = 3
[   10.073666] RTW: [HALMAC]HALMAC_MINOR_VER_88XX = 6
[   10.073667] RTW: [HALMAC]HALMAC_PATCH_VER_88XX = 2
[   10.077638] snd_hda_intel 0000:04:00.1: Handle vga_switcheroo audio client
[   10.085819] Bluetooth: Core ver 2.22
[   10.085894] NET: Registered protocol family 31
[   10.085895] Bluetooth: HCI device and connection manager initialized
[   10.085902] Bluetooth: HCI socket layer initialized
[   10.085905] Bluetooth: L2CAP socket layer initialized
[   10.085914] Bluetooth: SCO socket layer initialized
[   10.094396] RTW: WARN [HALMAC][WARN]Dump logical efuse in suspend mode
[   10.096464] r8169 0000:02:00.0 eno1: renamed from eth0
[   10.098796] RTW: 0x000: 
... a lot of hex values ...
[   10.099281] RTW: rtw_read_efuse_from_file /system/etc/wifi/wifi_efuse_8821ce.map is not readable
[   10.099294] RTW: hal_com_config_channel_plan chplan:0x7F
[   10.107683] RTW: rtw_regsty_chk_target_tx_power_valid return _FALSE for band:0, path:0, rs:0, t:-1
...
[   10.130886] RTW: rtw_ndev_init(wlan0) if1 mac_addr=dc:a2:66:62:67:61
[   10.131500] RTW: module init ret=0
[   10.137779] rtl8821ce 0000:03:00.0 wlo1: renamed from wlan0
[   10.141227] usbcore: registered new interface driver btusb
[   10.143287] Bluetooth: hci0: RTL: rtl: examining hci_ver=08 hci_rev=826c lmp_ver=08 lmp_subver=a99e
[   10.143291] Bluetooth: hci0: RTL: rtl: unknown IC info, lmp subver a99e, hci rev 826c, hci ver 0008
...
[   17.542001] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.542002] Bluetooth: BNEP filters: protocol multicast
[   17.542007] Bluetooth: BNEP socket layer initialized

Thanks for your work, let me know if there's anything else you need.

@tomaspinho
Copy link
Owner

Hey @wahsot

What happens when you sudo hciconfig hci0 up?

@wahsot
Copy link
Author

wahsot commented Jan 2, 2019

Hi @tomaspinho,

$ sudo hciconfig hci0 up
Can't init device hci0: Invalid argument (22)

@tomaspinho
Copy link
Owner

Can you paste here the output of lsusb -t?

@wahsot
Copy link
Author

wahsot commented Jan 2, 2019

$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 10000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 1: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 3: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M

@wahsot wahsot changed the title Bluetooth not working Bluetooth not working [0bda:b00a] Jan 4, 2019
@tomaspinho
Copy link
Owner

Thanks for the update on the vendor and device IDs. Actually it looks like we don't have the same adapter, mine prints:

  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0xc024 

@wahsot
Copy link
Author

wahsot commented Jan 4, 2019

I have been digging through the Ubuntu patches
https://patchwork.ozlabs.org/project/ubuntu-kernel/list/?submitter=9280

It keeps referring to 8211CU for bluetooth, should I try rtl8821cu-dkms-git to test its bluetooth?

Could this be a kernel issue instead? Should I raise a ticket to Arch?

@tomaspinho
Copy link
Owner

Yes, it may be that you have the CU variant. I don't believe that these adapters have upstream support yet, so official support will take a long while.

@wahsot
Copy link
Author

wahsot commented Jan 7, 2019

I tried 8211CU, the wifi then doesn't work.
What's your kernel / dmesg line in comparison with:
Bluetooth: hci0: RTL: rtl: examining hci_ver=08 hci_rev=826c lmp_ver=08 lmp_subver=a99e

@tomaspinho
Copy link
Owner

[    3.317578] Bluetooth: hci0: rtl: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821

@wahsot
Copy link
Author

wahsot commented Jan 7, 2019

Thanks @tomaspinho it just looks like all I need to do is make the kernel accept my hci_rev and lmb_subver to use "rtl_bt/rtl8821c_fw.bin" as that's what it would be doing on your system.

Based on Archlinux 4.20:

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 41405de27d66..9afc62490715 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -151,6 +151,13 @@ static const struct id_table ic_id_table[] = {
          .has_rom_version = true,
          .fw_name  = "rtl_bt/rtl8822b_fw.bin",
          .cfg_name = "rtl_bt/rtl8822b_config" },
+
+       /* 8821CE b00a */
+       { IC_INFO(0xa99e, 0x826c),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8821c_fw.bin",
+         .cfg_name = "rtl_bt/rtl8821c_config" },
        };
 
 static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,

After a 'quick' custom kernel compile and reboot:

[   10.461473] usbcore: registered new interface driver btusb
[   10.462865] Bluetooth: hci0: RTL: rtl: examining hci_ver=08 hci_rev=826c lmp_ver=08 lmp_subver=a99e
[   10.465879] Bluetooth: hci0: RTL: rom_version status=0 version=1
[   10.465882] Bluetooth: hci0: RTL: rtl: loading rtl_bt/rtl8821c_fw.bin
[   10.467101] Bluetooth: hci0: RTL: rtl: loading rtl_bt/rtl8821c_config.bin
[   10.467165] Bluetooth: hci0: RTL: rtl: assuming no firmware upload needed
...
[   21.936906] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   21.936907] Bluetooth: BNEP filters: protocol multicast
[   21.936911] Bluetooth: BNEP socket layer initialized
...
[   60.272646] Bluetooth: RFCOMM TTY layer initialized
[   60.272652] Bluetooth: RFCOMM socket layer initialized
[   60.272658] Bluetooth: RFCOMM ver 1.11
...
[  201.807734] Bluetooth: hci0: last event is not cmd complete (0x0f)
[  217.808820] Bluetooth: hci0: last event is not cmd complete (0x0f)
[  262.816011] Bluetooth: hci0: last event is not cmd complete (0x0f)
...
[  272.944091] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  272.944095] Bluetooth: HIDP socket layer initialized
[  272.963691] input: Bluetooth Mouse M336/M337/M535 Mouse as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-2/3-2.3/3-2.3:1.0/bluetooth/hci0/hci0:2/0005:046D:B016.0002/input/input15
[  272.963791] input: Bluetooth Mouse M336/M337/M535 Consumer Control as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-2/3-2.3/3-2.3:1.0/bluetooth/hci0/hci0:2/0005:046D:B016.0002/input/input16
[  272.963860] input: Bluetooth Mouse M336/M337/M535 Keyboard as /devices/pci0000:00/0000:00:08.1/0000:04:00.4/usb3/3-2/3-2.3/3-2.3:1.0/bluetooth/hci0/hci0:2/0005:046D:B016.0002/input/input19
[  272.964036] hid-generic 0005:046D:B016.0002: input,hidraw1: BLUETOOTH HID v12.03 Mouse [Bluetooth Mouse M336/M337/M535] on dc:a2:66:62:67:62

I can finally connect to my dongle-less Logitech mouse XD
Loving this new laptop even more.

There are some last event is not cmd complete (0x0f) errors, do you get that as well?

I suppose I will run this for a couple of weeks and then suggest the patch.

@tomaspinho
Copy link
Owner

tomaspinho commented Jan 7, 2019

Wow, amazing work! 🎉

Would you be so kind as to write up a quick tutorial on how to solve this kind of problem so that I can include it in the README? If you're up for that, a Pull Request is incredibly welcome. 😛

Yes, I get a ton of those errors and Bluetooth devices work well.

@wahsot
Copy link
Author

wahsot commented Jan 8, 2019

Bluetooth [0bda:b00a] Archlinux Kernel Patch

Diagnosis

Verify that your Bluetooth is not detected as lmp_subver=8221 & hci_ref=000c.

$ dmesg | grep 'RTL: rtl:'
[   10.143287] Bluetooth: hci0: RTL: rtl: examining hci_ver=08 hci_rev=826c lmp_ver=08 lmp_subver=a99e
[   10.143291] Bluetooth: hci0: RTL: rtl: unknown IC info, lmp subver a99e, hci rev 826c, hci ver 0008

Prepare Linux

Follow the steps on Arch Wiki Kernel/Arch Build System.

$ asp update linux
$ asp checkout linux
$ cd linux/trunk

Patch and Build

Extract this ZIP file to the current directory linux-4.20-rtl8821ce-b00a.zip.
Should you have a different IC_INFO(lmp_subver, hci_rev), update it inside "rtl8821ce-b00a.patch".
Should you have a different kernel version to 4.20, don't run patch and just open in text editor to humanly patch PKGBUILD.

$ patch -p0 -i pkgbuild.diff
$ makepkg -L

Install

Makepkg should have created 3 files: kernel, headers and docs (optional).
Remember to update your bootloader with this new custom kernel.

# pacman -U linux-custom{,-headers}-4.20.arch1-1-x86_64.pkg.tar.xz

Feedback

Let me know if it works for you, then it can be proposed to the Bluetooth maintainers.

@finlaywashere
Copy link

this worked for my computer

@tomaspinho
Copy link
Owner

Great, I've added the link to @wahsot 's tutorial in the README. 🙇‍♂️

@wahsot
Copy link
Author

wahsot commented Jan 14, 2019

Coming back from Linux's Bugzilla 201921:
This bug appears after rebooting from Linux.
When cold-booting the laptop, Bluetooth works with the vanilla kernel.
The patch in this ticket is still relevant if you need to restart your computer.

We could probably just close this ticket here as it's a kernel issue.
Thanks for your time.

@IceM4nn
Copy link

IceM4nn commented May 22, 2019

Hey @wahsot can you show us some guide to do that on debian based distro? where the rtl8821ce-b00a.patch should run?

@IceM4nn
Copy link

IceM4nn commented May 22, 2019

is there a method to patch it without recompile the whole kernel? or is it possible to make it as a dkms module? (for this little bluetooth patch only)

@IceM4nn
Copy link

IceM4nn commented May 24, 2019

Nevermind, I got my bluetooth running now. forgot to enable bluetooth.service. thanks

@alfabuster
Copy link

OS: Solus x86_64
Host: TUF Gaming FX505DY_TUF505 1.0
Kernel: 5.1.14-121.current

Wi-Fi works great, bluetooth doesn't work...

@wahsot
Copy link
Author

wahsot commented Jul 28, 2019

Wi-Fi works great, bluetooth doesn't work...

Can you provide Bluetooth kernel logs?
$ dmesg | grep Bluetooth

Does it show a different lmp_subver / hci_rev number after rebooting compared to a fresh start?

@tvajtay
Copy link

tvajtay commented Sep 13, 2019

A hard reset/cold boot seems to fix the bluetooth failure on Ubuntu 19.04. Very bizzare

kelebek333 added a commit to kelebek333/backport-btrtl-dkms that referenced this issue Nov 6, 2019
Add support for rtl8821ce
Applied this patch => tomaspinho/rtl8821ce#19 (comment)
@BurningGrip3
Copy link

Can someone please post a guide on what to do if your kernel version is different than 4.20? Because that part is a bit confusing.
I'm running kernel 5.8.9-arch2-1.

@roninvanderwerke
Copy link

Same I also get confused when asked to humanly patch. I changed the kernel name in the patch but that doesn't work. I'm on Manjaro 5.8.11-1.

Can someone please post a guide on what to do if your kernel version is different than 4.20? Because that part is a bit confusing.
I'm running kernel 5.8.9-arch2-1.

@BurningGrip3
Copy link

Can someone please post a guide on what to do if your kernel version is different than 4.20? Because that part is a bit confusing.
I'm running kernel 5.8.9-arch2-1.

Anyone?

@zefir-git
Copy link

Same issue on Ubuntu 20.04.01 LTS kernel 5.8.0-38-generic. The APT driver doesn't work either.
Anyone got any info?

@riyuuzaki-git
Copy link

I am having the same issue. On Ubuntu 20.04

My device is bind to another driver. And it seems that i cannot bind it to the one you published 🙁
root@LION-SLEW1:~# lspci | grep Realtek 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15) 03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter

The first one is the Bluetooth Device and the second one is the Netword Card, which i found to be one and only one card that does both jobs.

But here is the issue :

root@LION-SLEW1:/sys/bus/pci/devices/0000:02:00.0# ls -l | grep driver total 0 lrwxrwxrwx 1 root root 0 zan 24 02:00 driver -> ../../../../bus/pci/drivers/r8169

And this driver is not what it should be

I tried to manually unbind and bind the rtl8821ce driver, but it won't let me.

root@LION-SLEW1:/sys/bus/pci/devices# echo -n "0000:02:00.0" > /sys/bus/pci/drivers/r8169/unbind root@LION-SLEW1:/sys/bus/pci/devices# echo -n "0000:02:00.0" > /sys/bus/pci/drivers/rtl8821ce/bind -bash: echo: write error: No such device

I downloaded another driver that seems to be doing the same thing, and tried to bind it, but i got the same result.
root@LION-SLEW1:/sys/bus/pci/devices# echo -n "0000:02:00.0" > /sys/bus/pci/drivers/rtw_8821ce/bind -bash: echo: write error: No such device

I would be very grateful if anyone can help me please.

@zefir-git
Copy link

zefir-git commented Jan 24, 2021

For me it resolved after typing sudo modprobe btrtl sudo systemctl restart bluetooth sudo bluetoothctl power on

EDIT: I'm using the driver on apt

@riyuuzaki-git
Copy link

riyuuzaki-git commented Jan 24, 2021

For me it resolved after typing sudo modprobe btrtl sudo systemctl restart bluetooth sudo bluetoothctl power on

I tried it but it won't work :(

root@LION-SLEW1:~# sudo modprobe btrtl
root@LION-SLEW1:~# systemctl restart bluetooth
root@LION-SLEW1:~# bluetoothctl power on
No default controller available
root@LION-SLEW1:~#

@Jangberry
Copy link

I think I begin to see a patern: each time I upgrade my kernel (so dkms do another build) it potentially break the bluetooth (damaged wifi only once). Some times removing it from dkms tree and rebuilding it specifically for the new kernel appart from the upgrade routine is enough but sometimes I need to install or remove btrtl... (what a nightmare)

I run Debian sid, and for instance with Kernel 5.10.0-1 I needed to install btrtl, for 5.10.0-2 nothing has been needed, and finnally for 5.10.0-3 I needed to remove brtrtl (I also tried to reinstall rtl8821ce as a first attempt but it didn't seemed to do much)

Hope it helps for debugging

BTW my computer is an Asus TUF 505DY and almost none of the diagnostics/fixes that works with Lenovo computers works on mine... for instance dmesg | grep 'RTL: rtl:' doesn't output anything, I can't (obviously) install lenovo's binaries, etc...

@vascofaraujo
Copy link

For those on Debian that still have problems, what did the trick for me was installing firmware-realtek.

@0xdamak
Copy link

0xdamak commented Nov 28, 2021

For those on Debian that still have problems, what did the trick for me was installing firmware-realtek.

Just wanna confirm this works like a charm. Thanks, Vasco.

@LAfricain
Copy link

Hi,
How to patch this on Ubuntu?

@stilnovo
Copy link

Hi to Everybody!

I run Debian 11 and Lubuntu 20.04: please, could you suggest a sort of tutorial also for Debian/Ubuntu users?

I've tried to install the 5.15 kernel, and for five/six minutes this wi-fi card properly works, both wi-fi and bluetooth. After this short period of time the connection becomes unstable (the computer seems correctly connected, but internet and bluetooth don't work).

So, thanks to the great job of @tomaspinho now I have wi-fi connection on my HP laptop, but no bluetooth, so now I will buy a bluetooth dongle, but it's a pity... help!

@Viom888
Copy link

Viom888 commented Apr 1, 2023

sudo apt-get update

sudo apt-get install firmware-realtek

I tried this and worked

@Rustmilian
Copy link

Rustmilian commented Mar 22, 2024

BTW my computer is an Asus TUF 505DY and almost none of the diagnostics/fixes that works with Lenovo computers works on mine... for instance dmesg | grep 'RTL: rtl:' doesn't output anything, I can't (obviously) install lenovo's binaries, etc...

Because that's a bad command.
Use either dmesg | grep 'RTL:' or dmesg | grep Bluetooth for example :

sudo dmesg | rg 'RTL:' 

[   10.813025] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
[   10.814570] Bluetooth: hci0: RTL: rom_version status=0 version=1
[   10.814575] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_fw.bin
[   10.816196] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_config.bin
[   10.816290] Bluetooth: hci0: RTL: cfg_sz 10, total sz 34926
[   11.426197] Bluetooth: hci0: RTL: fw version 0x75b8f098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests