Requesting support for Tp-link UB500 Bluetooth adapter

Nope, 5.15 (The latest one). Also this patch is already there in bluetooth-next branch, So we can hope to get this fixed soon.

I DID IT !! Although your solution didn’t work, but I finally figured out what was going wrong ! I was building the kernel source from git clone https://gitlab.manjaro.org/packages/core/linux514.git
BUT the linux514.git contained the source files and patches for the latest revision of 5.14 which is 5.14.17. While my system has 5.14.10. Thats why it was showing the error while starting the module. Essentially I was building the module for 5.14.17 and trying to apply it to 5.14.10. I just had to revert to the 5.14.10 commit and it worked ! Thanks for your time, this has been a great learning experience :smile:

I DID IT !! I finally figured out what was going wrong ! I was building the kernel source from git clone https://gitlab.manjaro.org/packages/core/linux514.git
BUT the linux514.git contained the source files and patches for the latest revision of 5.14 which is 5.14.17. While my system has 5.14.10. Thats why it was showing the error while starting the module. Essentially I was building the module for 5.14.17 and trying to apply it to 5.14.10. I just had to revert to the 5.14.10 commit and it worked ! Make sure you have the matching version of kernel before you makepkg --nobuild. you have to set the commit number to your desired kernel version. To revert to 5.14.10 commit you have to do git reset iCommitNumber --hard where you replace iComitNumber with the commit version which is 1dc694e502184c1e9afe78914e82327fe264a9e4. So your final command to run BEFORE makepkg --nobuild will be git reset 1dc694e502184c1e9afe78914e82327fe264a9e4 --hard. I know this can be confusing as hell, so if you get stuck, then feel free to reply ! I will be happy to help you :smile:

1 Like

Wow nice! thanks again for posting the solution, it worked on my side as well! :smiley:

Your welcome ! Happy I could help :smile:

Good News everyone, Linux 5.16 includes this patch by default.

The first release candidate of it has been released and the final release is expected in early January 2022.

I’m using Arch Linux
I have installed linux-mainline 5.16rc1-1from AUR , I have not been able to start the graphics server (I have nvidia dkms but it does not start) but I have noticed that from the terminal it can read the bluetooth. I have extracted btusb.ko.zst v5.16 but it doesn’t work on 5.15.2

I am now trying to install the patch on 5.15.2.arch1-1

That is awesome news! I’ll grab one of these now. Thank you guys for the update!

That’s not how it work AFAIK, Kernel modules are not easily backported, you have to rebuild the whole kernel for that.

I have kernel:
5.15.2-arch1-1

I downloaded the kernel from here

I followed the instructions by only modifying btusb.
I copied .config and Module.symvers to the build folder

I compiled the kernel
I copied btusb.ko, compressed to btusb.ko.zst and replaced the original one.

I keep getting the error:
modprobe: ERROR: could not insert 'btusb': Exec format error

I’ve been going crazy for a week to get this key to work… (I will have compiled at least 4 kernels)

Thats because your kernel version is not EXACTLY the same with your module version. You cannot use module v5.16 with kernel 5.15.2. The versions are completely different ! Also you are using the latest mainline kernel, from vanilla arch I guess ? I would encourage you to roll back to a stable kernel verion, because an actively developing kernel may get multiple commits and patches every single day, and trust me, it messes with your module building process.

I will try to help you, module building can get a bit confusing !
First, try to provide any errors except modprobe: ERROR: could not insert 'btusb': Exec format error if you are getting any.
Second, do uname -r and tell me what it returns.
Third, are you running absolute vanilla arch or a fork ?

This article is actually linked to this article. Please make sure to look into that article as well, and also change the kernel version to your own kernel version in the several commands shown in this article. I just built the patched btusb module in the new kernel 5.15.2-2-MANJARO and it works flawlessly !

Bluetooth monitor ver 5.62
= Note: Linux version 5.15.2-arch1-1 (x86_64)                          0.764499
= Note: Bluetooth subsystem version 2.22                               0.764500

nov 19 21:34:35 archlinux systemd[1]: Starting Bluetooth service...
nov 19 21:34:35 archlinux bluetoothd[13881]: Bluetooth daemon 5.62
nov 19 21:34:35 archlinux bluetoothd[13881]: D-Bus setup failed: Connection ":1.284" is not allowed to own the serv>
nov 19 21:34:35 archlinux bluetoothd[13881]: src/main.c:main() Unable to get on D-Bus
nov 19 21:34:35 archlinux systemd[1]: bluetooth.service: Main process exited, code=exited, status=1/FAILURE
nov 19 21:34:35 archlinux systemd[1]: bluetooth.service: Failed with result 'exit-code'.
nov 19 21:34:35 archlinux systemd[1]: Failed to start Bluetooth service.
uname -r
5.15.2-arch1-1

im using vanilla arch (Gnome)

Thanks, i’m reading now

Looks like a common failure of the bluetooth.service deamon not able to initiate a dbus interface to the bluetooth dongle or which ever bluetooth adapter you are trying to use. Do you currently have the gnome gui working ? If yes, then after plugging in the dongle, open bluetooth settings and see if the adapter atleast shows up or not. For the tp-link UB500 specifically, the adapter itself shows up but it cannot search for any bluetooth devices. Also which buletooth device are you using ? UB500 ?
Also please note that the module building and patching process is a bit different for manjaro and vanilla arch. This article is specifically for manjaro. I haven’t tried building the module in vanilla arch. Please refer to the arch linux forums for your specific problem.

1 Like

Yes i have Gnome and UB500.
In bluethooth settings there is a switch to activate it but it is locked.

When I didn’t have the patch and ran btusb it was possible to activate it but nothing appeared.

Thanks for your help

If you followed the tutorial in this article, when you did makepkg --nobuild the imidiate output of the command should show the kernel verion for which it is downloading the source files.
Since your kernel version is 5.15.2-arch1-1 the the above command should show :-

~/build/linux515/master > makepkg --nobuild                                          ✔ 
==> Making package: linux515 5.15.2-arch1-1 (Saturday 19 November 2021 12:10:56 PM)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading linux-5.15.tar.xz...

Please make sure your kernel version and the version shown in the makepkg --nobuild command is the exact same.
(I edited the above command output to match your kernel version, your actual command output should look fairly similar to this.)

In case the kernel version in the makepkg output is different than your kernel version, then you have to start fresh, and BEFORE doing makepkg --nobuild you have to enter this command git reset iCommitNumber --hard where iCommitNumber is the EXACT git commit that has your EXACT kernel version. You said that you pulled the source files from here.
This branch has the source for kernel version 5.15.2-arch1 where your kernel version is 5.15.2-arch1-1. See ? Your kernel version has an extra -1 at the end, that means it is not the same as the one in github.


I think this is why you are facing the error. I think you should try to find the source files for your exact kernel or revert to 5.14 kernel and find its source files from github or aur.
Edit : I just checked the linux 5.16 kernel source files, and they have added the support for UB500 ! So if you cannot get the module to work, then just wait for the 5.16 kernel !

1 Like

The patch for /drivers/bluetooth/btusb.c has been added to kernel 5.16rc1
btusb.c - drivers/bluetooth/btusb.c - Linux source code (v5.16-rc1) - Bootlin

And kernel v5.16rc1 is available in all Manjaro branches
Manjaro Branch Compare - Linux516

2 Likes

Yeah I saw that just yesterday ! I will try out the 5.16 kernel soon.