Page 2 of 2

Re: [Software] Every kernel upgrade bluetooth drivers dissapear

Posted: 2023-08-19 14:57
by Aki
Hello,
lospala wrote: 2023-08-18 19:31 Cheers it works !!!
...
After that I upgraded to kernel 6.1.38-4 and upon reboot I could connect headphones automatically !!!
...
I'm glad you sorted it out. :-)

I hope it will be useful to other users who wants to configure the dkms for their kernel modules.

It would probably useful to add the chipset name to the subject of the first post, for example:
[Software] [Solved] How to install Realtek 8761b Bluetooth driver with dkms
Happy Debian :-)

- -- - -- - -- - --- -- - --- -- - --- -- - --- -- - --- -- - --- -- - --

I report below the command of my previous post with a correction for the cat command (the $ character need to be escaped):

Code: Select all

# Documentation:
#       https://wiki.debian.org/BuildADebianKernelPackage
#       https://wiki.debian.org/KernelDKMS
#       https://manpages.debian.org/bookworm/dkms/dkms.8.en.html

# The following commands should be given as root user
apt install install build-essential linux-source bc kmod 
apt install cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison 

# Source code from: 
#       git clone https://aur.archlinux.org/rtl8761usb.git
#
# note: 
#       1) the license of this code is unknown and it is not included in source code
#       2) the source code is hosted outside AUR repositories
#       3) here is covered only the building witk dkms of "rtk_btusb" custom kernel module 
#          (another kernel modules named "uart" is included in source code, but I don't
#          know if it is always required)
#       4) custom firmware installation seems to be required (from downloaded file)

# Download the source code
wget https://archive.org/download/mpow_mpbh456ab_driverforlinux/mpow_MPBH456AB_driver%2Bfor%2BLinux.tgz

# Uncompress and untar source code
tar xvf mpow_MPBH456AB_driver+for+Linux.tgz

# Change current directory to the custom "rtk_btusb" kernel module
cd 20200610_LINUX_BT_DRIVER/usb/bluetooth_usb_driver

# Create the dkms.conf file in the custom module's source code directory
# named 20200610_LINUX_BT_DRIVER/usb/bluetooth_usb_driver
cat << EOF > dkms.conf
PACKAGE_NAME=rtk_btusb
PACKAGE_VERSION=20200610
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
MAKE[0]="make -C \${kernel_source_dir} M=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build"
CLEAN="make -C ${kernel_source_dir} M=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build clean"
DEST_MODULE_LOCATION[0]=/extra
AUTOINSTALL=yes
EOF

# Add custom module to dkms (from current directory) with dkms.conf file
dkms add $PWD

# Build custom module with dkms
dkms build -m rtk_btusb -v 20200610

# Install custom module with dkms 
dkms install -m rtk_btusb -v 20200610

# Install custom firmware file from 20200610_LINUX_BT_DRIVER/ directory
cd ../../
cp -vi rtkbt-firmware/lib/firmware/rtl* /lib/firmware/

# Blacklist btusb kernel module (conflicts with this custom kernel module named "rtk_btusb")
# note: it will be impossible to use other kernel bluetooth dongles devices based on btusb kernel module.
echo "blacklist btusb" > /etc/modprobe.d/btusb_blacklist.conf

# Update the initramfs
update-initramfs -u

# After building the module:
modinfo rtk_btusb
filename:       /lib/modules/6.1.0-11-amd64/updates/dkms/rtk_btusb.ko
license:        GPL
version:        3.1.9321f79.20200610-155144
description:    Realtek Bluetooth USB driver ver 3.1.9321f79.20200610-155144
author:         
srcversion:     9D390BD101025C4B42E4801
alias:          usb:v1358p*d*dc*dsc*dp*icE0isc01ip01in*
alias:          usb:v0489p*d*dc*dsc*dp*icE0isc01ip01in*
alias:          usb:v13D3p*d*dc*dsc*dp*icE0isc01ip01in*
alias:          usb:v0BDAp*d*dc*dsc*dp*icE0isc01ip01in*
depends:        usbcore,bluetooth
retpoline:      Y
name:           rtk_btusb
vermagic:       6.1.0-11-amd64 SMP preempt mod_unload modversions 
sig_id:         PKCS#7
signer:         DKMS module signing key
sig_key:        BC:9F:18:0A:24:22:D8:B0:2A:DC:77:5D:0A:3B:A1:AF:E4:B4:6A
sig_hashalgo:   sha256
signature:      55:F6:B6:3C:91:A5:24:E2:7F:8A:37:07:FA:73:8B:73:34:04:2D:C2:
                E0:9F:B4:E7:DD:BA:41:64:D3:B0:B4:35:2A:43:F3:01:08:BC:BA:0C:
                42:A1:1F:1B:28:72:7A:95:7B:CC:E6:F9:F0:7B:23:CC:F6:7D:A8:60:
                9B:DA:D2:03:83:32:6A:3E:4D:B1:A6:2E:31:5D:8F:7E:F8:F7:73:B2:
                27:F9:97:66:F5:CA:94:34:1E:AD:9B:C2:BD:3C:F8:7C:C9:6E:46:6F:
                E2:CB:D7:F0:20:73:5F:97:30:2E:49:CB:4C:3E:EF:F3:1D:42:0C:44:
                E4:7B:54:09:49:55:D1:B2:91:2F:B1:65:09:F2:BE:30:6C:2C:48:26:
                28:C5:21:AA:83:A4:AA:FD:53:B8:05:46:D0:3B:ED:A0:B8:EE:88:0F:
                E2:98:A3:12:10:1F:23:39:CF:16:74:40:0D:DF:BF:CF:AE:F0:B5:B3:
                00:A5:52:75:B0:FE:14:62:8A:36:A8:D0:3D:FE:8F:0C:9A:D6:F3:94:
                24:D4:8A:F5:66:F5:FB:9D:C9:60:71:3F:A3:02:08:AD:3F:22:9A:4B:
                23:5A:FB:87:E5:66:A6:4F:0C:78:5D:C2:FA:F8:FB:CE:B6:03:D1:38:
                4D:0C:DA:71:D1:88:83:E0:3F:B5:82:44:90:4C:3B:64

Re: [Solved] How to install Realtek 8761b Bluetooth driver by dkms with dkms

Posted: 2023-08-19 15:26
by lospala
Hi Aki

I have changed the post Title as per your suggestion. I also hope it might be useful for other members or anyone in Internet
I keep your amended syntax as a manual
Thanks once more for your help
Best regards