Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MPOW BH456A Bluetooth USB Adapter Kernel Module Adjustements (Realtek RTL8761B chip)

Problem

The MPOW Bluetooth 5 dongle (Model: BH456A) does not work out of the box on Ubuntu 20.04 (kernel 5.4.0-42).

Solution

Patch the bluetooth kernel module and copy the firmware binaries to /lib/firmware.

Copy the fimware

MPOW hosts a linux driver on their homepage. Download it via:

wget https://mpow.s3-us-west-1.amazonaws.com/mpow_MPBH456AB_driver+for+Linux.tgz

Extract the contents

tar xvf mpow_MPBH456AB_driver+for+Linux.tgz

and copy the firmware files to the appropriate system directory

SRCDIR="20200610_LINUX_BT_DRIVER/rtkbt-firmware/lib/firmware"
sudo cp $SRCDIR/rtl8761bu_fw /lib/firmware/rtl_bt/rtl8761b_fw.bin
sudo cp $SRCDIR/rtl8761bu_config /lib/firmware/rtl_bt/rtl8761b_config.bin

Patch the bluetooth kernel module

This patch fixed a bug in the bluetooth module wrongly identifying the bluetooth chip as another version. For reference, I added the patch to this gist.

To fix this, get the kernel source

git clone --depth 1 --single-branch --branch master git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git

for your ubuntu version. Change master for whatever version you are on if its different.

Then apply the patch with

patch -p 1 <  2-1-1-Bluetooth-btrtl-Add-support-for-RTL8761B.diff

and fix possible conflicts.

Then its time to build the bluetooth module.

First copy the old driver

sudo cp -r /lib/modules/$(uname -r)/kernel/drivers/bluetooth
/lib/modules/$(uname -r)/kernel/drivers/bluetooth_bak

Inside the cloned repository first get the current kernels config

make oldconfig
make prepare
make scripts

and build the bluetooth module

cd drivers/bluetooth
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules

and copy the ko module files to the systems module dir which we backed up before.

sudo cp *.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth

This will overwrite the existing modules. Running make install didn't work for me because of a missing certification error. Probably the official Ubuntu kernel is signed.

I don't have secure boot activated, so for we unsigned drivers work fine.

Now reboot and everything should be fine.

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 67f4bc21e7c5..3a9afc905f24 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -130,12 +130,19 @@ static const struct id_table ic_id_table[] = {
.cfg_name = "rtl_bt/rtl8821c_config" },
/* 8761A */
- { IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0,
+ { IC_INFO(RTL_ROM_LMP_8761A, 0xa),
.config_needed = false,
.has_rom_version = true,
.fw_name = "rtl_bt/rtl8761a_fw.bin",
.cfg_name = "rtl_bt/rtl8761a_config" },
+ /* 8761B */
+ { IC_INFO(RTL_ROM_LMP_8761A, 0xb),
+ .config_needed = false,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8761b_fw.bin",
+ .cfg_name = "rtl_bt/rtl8761b_config" },
+
/* 8822C with UART interface */
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
IC_MATCH_FL_HCIBUS,
@@ -267,6 +274,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
{ RTL_ROM_LMP_8822B, 13 }, /* 8822C */
+ { RTL_ROM_LMP_8761A, 14 }, /* 8761B */
};
min_size = sizeof(struct rtl_epatch_header) + sizeof(extension_sig) + 3;
@jns-v
Copy link

jns-v commented Nov 3, 2020

Hi @rometsch,
I have got an MPOW BH456A as well however it came with a driver mini disc containing the rtl8761bu firmware files. The dongle actually worked with the 5.4.72 lts kernel (arch) but broke with the next iteration. Now I wonder if I can just adapt your code to load the approptiate firmware files. However I am not sure about how to change lines 17 and 30 of your patch. Can you provide some insight into what the values mean and maybe how I'd have to change those? Thanks in advance.
Best regards

@rometsch
Copy link
Author

rometsch commented Nov 24, 2020

Hi @jns-v,
Hopefully you found a solution to you problem in the meantime. In case you didn't, let me try my best.

Unfortunately I don't know the values for your case. I found the patch inside a bug report written by another person.

One thing you could try is to get the 5.4.72 arch kernel source and have a look at drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c to see how the device is handled there. My guess would be that there is an entry in the form of IC_INFO(RTL_ROM_LMP_8761A, 0x...) which identifies the device, just as in the patch above. There should then be an entry like line 17 and following of the patch.
Copying these pieces over to the current kernels source and compiling the bluetooth drivers as in my readme above could work.

Good luck!
Thomas

@felix-ht
Copy link

felix-ht commented Dec 4, 2020

@rometsch my ubnunt 20.04 install has the 5.4.0-56-generic kernel. git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git only has a branch for Ubuntu-5.4.0-54.60.
Any idea where i can download the sources for 5.4.0-56?

@felix-ht
Copy link

felix-ht commented Dec 4, 2020

This worked for me

sudo apt-get source linux-source-5.4.0
cd ~/linux-5.4.0

After this i just followed the steps above.

Thanks a lot @rometsch now i have a working bluethooth 5 stick 👍

@jns-v
Copy link

jns-v commented Dec 5, 2020

Hi @rometsch,

Actually I wasn't able to solve this issue. I somehow managed to compile a kernel but it seems i messed up the config a bit so it wasn't usable at all. I switched to the ck-skylake kernel (for Arch) in the meantime and the dongle is working on the latest two iterations.
I really appreciate your response though and should bluetooth break again, I'll certainly look into it.

Regards
Jonas

@rometsch
Copy link
Author

rometsch commented Dec 10, 2020

@jns-v: Glad you found a work-around! Your solution might be more sustainable, since I need to repeat my steps on every kernel update. Seems that th ck kernel is up to date enough and ck seems to introduce many patches early.

@rometsch
Copy link
Author

rometsch commented Dec 10, 2020

@felix-ht happy to hear that my notes were helpful for you!

@CassianoSF
Copy link

CassianoSF commented Jan 7, 2021

Worked for me!
But I had to patch the source manually.

Thank you!!!

Noise Canceling On 😎

@rometsch
Copy link
Author

rometsch commented Jan 8, 2021

Seems like kernel version 5.8 implements the change :)
So hopefully this guide wont be necesarry for much longer!
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/bluetooth/btrtl.c?h=linux-5.8.y

@patricklibert
Copy link

patricklibert commented Jan 16, 2021

Tested. With Ubuntu 20.04.1 HWE 5.8 kernel.
Patching is no longer necessary.
Just copy the drivers....

@nowls
Copy link

nowls commented Jan 19, 2021

I second @patricklibert's comment. With Ubuntu 20.04.1 and HWE 5.8 kernel, all I had to do was copy over the firmware blobs.

sudo apt install --install-recommends linux-generic-hwe-20.04

Then copy the firmware.

See the Ubuntu LTS Enablement Stack page for more information.

@mgrachten
Copy link

mgrachten commented Feb 12, 2021

The firmware blobs are architecture independent, is that correct? I'm considering buying this adapter to use with an ARM64 architecture running armbian with a 5.10 kernel.

@FL33TW00D
Copy link

FL33TW00D commented Feb 16, 2021

Worked for me no need to patch!
Many thanks

@VladimirMrzv
Copy link

VladimirMrzv commented Mar 20, 2021

When attempt download file https://mpow.s3-us-west-1.amazonaws.com/mpow_MPBH456AB_driver+for+Linux.tgz got error forbidden 403
Can someone upload and give link.

upd: find here https://aur.archlinux.org/packages/rtl8761b-fw/

@mpaccione
Copy link

mpaccione commented May 13, 2021

I wish people on Amazon gave honest reviews about this trash. Complete fucking waste of time. Docs says it supports my kernel but it doesn't. Fucking useless. Let me go spend days figuring out this bullshit instead of just buying from a manufacturer who actually knows how to write an installer package. Jesus christ.

@FFxk4
Copy link

FFxk4 commented Aug 13, 2021

Thank you!!!
Work fine on Linux Mint 20.2 with 5.4.0-74 kernel.
Took 5.4.114 version from kernel.org as a source.

@FFxk4
Copy link

FFxk4 commented Sep 3, 2021

can anyone confirm if that bluetooth dongle works with wireless headsets?

I can confirm that 'Buro BU-BT50C' dongle (rtl8761b chip) works fine with 'Panasonic RB-HX220B' wireless headset )

@Movisivi
Copy link

Movisivi commented Sep 18, 2021

how can one disable the onboard bluetooth? Typically on windows I'd go to device manager and disable it then plug in the adapter and windows would read it. Or do will Ubuntu automatically prioritize the usb over onboard?

@arnesetzer
Copy link

arnesetzer commented Mar 22, 2022

Mpow updated the driver and changed the format. The first two steps are now:

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

Extract the contents

p7zip -d 20201202_mpow_BH456A_driver+for+Linux.7z

@dereks-igor
Copy link

dereks-igor commented Jul 20, 2022

Ubuntu 22.04 users: today these instructions stopped working due to a package update.

The new Bluetooth stack now looks for the (more accurate) filenames:

/lib/firmware/rtl_bt/rtl8761bu_fw.bin
/lib/firmware/rtl_bt/rtl8761bu_config.bin

Notice the addition of the letter "u" just before the underscore. So, all you should need to do after downloading the driver is copy them to the new location:

SRCDIR="20200610_LINUX_BT_DRIVER/rtkbt-firmware/lib/firmware"
sudo cp $SRCDIR/rtl8761bu_fw /lib/firmware/rtl_bt/rtl8761bu_fw.bin
sudo cp $SRCDIR/rtl8761bu_config /lib/firmware/rtl_bt/rtl8761bu_config.bin

If your device suddenly stopped working, you can confirm that this is your issue by running dmesg or tail -f /var/log/kern.log and then try to turn on Bluetooth under Gnome Menu > Bluetooth Settings. You should see an error message stating that it could not find the file rtl8761bu_fw.bin.

@rometsch
Copy link
Author

rometsch commented Jul 21, 2022

@dereks-igor adn @arnesetzer, many thanks for the updates!

@johann-petrak
Copy link

johann-petrak commented Aug 8, 2022

I do not understand these instructions, the file 20201202_mpow_BH456A_driver+for+Linux.7z
from https://mpow.s3-us-west-1.amazonaws.com/20201202_mpow_BH456A_driver+for+Linux.7z does not contain a file rtl8761bu_fw.bin
The URL https://mpow.s3-us-west-1.amazonaws.com/mpow_MPBH456AB_driver+for+Linux.tgz gives an access denied error.

I was able to fetch the individual files this way:

wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_bt/rtl8761bu_fw.bin
wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_bt/rtl8761bu_config.bin

After copying to /usr/lib/firmware/rtl_bt the files seem to get loaded, but then I get the error:
Bluetooth: hci0: RTL: extension section signature mismatch

I found a file https://mpow.s3-us-west-1.amazonaws.com/mpow_MPBH456AB_driver+for+Linux.tgz which expands to 20200610_LINUX_BT_DRIVER/ but this one also does not contain rtl8761bu_{config,fw.}bin

@johann-petrak
Copy link

johann-petrak commented Aug 9, 2022

@satels
Copy link

satels commented Aug 10, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment