Jump to content

add support for rtl8761bu

Featured Replies

Posted

I bought a bluetooth usb device using rtl8761bu chip, it can drive in unraid6.9.2 version, but when I run `bluetoothctl` scan on, it can't scan any device.

When looking for information, I found the kernel patch and the temporary solution.

patch: https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

temp: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1955916/comments/21

I followed the temporary solution and completed the following repair script

#!/bin/sh

set -e

ko_path=/lib/modules/"$(uname -r)"/kernel/drivers/bluetooth

sudo cp "${ko_path}"/btusb.ko.xz "${ko_path}"/btusb.ko.xz.bak
xz -dkf "${ko_path}"/btusb.ko.xz
xxd "${ko_path}"/btusb.ko | sed 's/ca04 0540/5025 6187/g' |xxd -r > "${ko_path}"/btusb.ko.mod
mv "${ko_path}"/btusb.ko.mod "${ko_path}"/btusb.ko
xz -f "${ko_path}"/btusb.ko
chmod 644 /lib/modules/"$(uname -r)"/kernel/drivers/bluetooth/btusb.ko.xz

sudo cp /boot/config/custom/firmware/rtl8761b* /lib/firmware/rtl_bt
chmod 644 /lib/firmware/rtl_bt/rtl8761b*

modprobe -r btusb && modprobe btusb

the usb device worked successfully.

Please let me know if this is fixed in 6.10.

 

 

 

Edited by VergilGao

  • 2 weeks later...
  • Author

Glad to see that this problem has been fixed in 6.10.0, but because unraid lacks the necessary driver, users using rtl8761bu need to release the driver to the corresponding location by themselves Note that the corresponding files are named as described in this post https://linuxreviews.org/Realtek_RTL8761B#comment-2320

  • 2 weeks later...

Would like to see rtl8761bu included or if anyone can make the driver as a plugin

  • 2 months later...

Also +1'ing this. Home assistant now supports Bluetooth. Those of us running Home Assistant via docker will hit this issue. 

I'm not sure how to get the above work arounds working so as for now, I can't use the USB bluetooth receiver I bought to control bluetooth devices with Home Assistant. 

I was able to get it working by following this thread

 

I installed "nerd tools" via community apps, went to the plugins tab in unraid and clicked the "nerd tools" icon... and then i searched for "bluez" and turned it on.

 

Next I putting the following in my /boot/config/go file. I also ran all it manually once

# Configure the Bluetooth driver
sudo curl -L https://raw.githubusercontent.com/Realtek-OpenSource/android_hardware_realtek/rtk1395/bt/rtkbt/Firmware/BT/rtl8761b_config -o /tmp/rtl8761bu_config.bin
sudo mv /tmp/rtl8761bu_config.bin /lib/firmware/rtl_bt/rtl8761bu_config.bin
sudo curl -L https://raw.githubusercontent.com/Realtek-OpenSource/android_hardware_realtek/rtk1395/bt/rtkbt/Firmware/BT/rtl8761b_fw -o /tmp/rtl8761bu_fw.bin
sudo mv /tmp/rtl8761bu_fw.bin /lib/firmware/rtl_bt/rtl8761bu_fw.bin

# Start Bluetooth
/etc/rc.d/rc.bluetooth start

 

Then I had to unplug the usb device, plug it back in and running some combination of the following made it work

  • /etc/rc.d/rc.bluetooth stop 
  • /etc/rc.d/rc.bluetooth start
  • sudo bluetoothctl

 

 

I tried this and can't get it to work.

 

In home assistant, it has an error on the integrations page for the bluetooth integration: Retrying setup: Failed to start Bluetooth: adapter 'hci0' not found

 

What exactly do you have passed in to the container? I have the path /var/run/dbus pointed to /var/run/dbus AND I have the device /dev/bus/usb/003/013 (as that's what's showing up for the bluetooth adapter in Tools > System Devices).

  • 3 weeks later...
On 8/6/2022 at 11:10 PM, runraid said:

Then I had to unplug the usb device, plug it back in and running some combination of the following made it work

 

A simpler way to force this is to disable and then re-enable the btusb kernel module with:

rmmod btusb
modprobe btusb

 

This forces re-detection of the device and causes it to load the drivers into the adapter right away.

 

Adding these lines to the end of your go script right after moving the files into /lib/firmware/rtlbt and before running `/etc/rc.d/rc.bluetooth start` should mean you don't have to mess around unplugging/replugging the adapter after a reboot.

  • 7 months later...
  • Author
On 8/12/2022 at 12:06 AM, God_TM said:

I tried this and can't get it to work.

 

In home assistant, it has an error on the integrations page for the bluetooth integration: Retrying setup: Failed to start Bluetooth: adapter 'hci0' not found

 

What exactly do you have passed in to the container? I have the path /var/run/dbus pointed to /var/run/dbus AND I have the device /dev/bus/usb/003/013 (as that's what's showing up for the bluetooth adapter in Tools > System Devices).

 

the homeassistant use dbus-broker and unraid use dbus-daemon as dbus-service.

i tried so other solution, and finally changed my homassistant to a raspberry pie.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...