How to make a USB bluetooth adapter work with WSL #310
Replies: 29 comments 54 replies
-
@hansmbakker However, I used them on a Hyper-V VM with a normal ubuntu kernel. I'm pretty sure for WSL you will have to compile your own kernel. But if you have the right drivers included, I'm pretty sure it'll work fine. |
Beta Was this translation helpful? Give feedback.
-
Oh that sounds promising! However, I also discovered that Following the suggestions in that stackoverflow post did not help solving the issue unfortunately. |
Beta Was this translation helpful? Give feedback.
-
I just did:
on Windows 10 WSL2. Seems to work just fine... EDIT: fix service command |
Beta Was this translation helpful? Give feedback.
-
Odd.. On a clean, but updated version of Ubuntu 20.04.3 LTS on Windows 11 / WSL2 I get:
|
Beta Was this translation helpful? Give feedback.
-
I had the service command reversed. See fixed version. |
Beta Was this translation helpful? Give feedback.
-
Can happen :) With a new kernel (I had to enable bluetooth support and its device drivers) I managed to have WSL2 detect the bluetooth adapter. Initially However,
I tried lots of things (like
|
Beta Was this translation helpful? Give feedback.
-
I get this for service bluetooth:
And this thread: moby/moby#16208 Since WSL is essentially running distro instances in a container, it looks like bluetooth is not going to work on WSL. Hyper-V is fine, though, so it's not the device support. It is the service support that is lacking... |
Beta Was this translation helpful? Give feedback.
-
Mm, that's too bad.. I thought that, in general to share Bluetooth with docker, one could specify some networking setup (to share the host network with the container)? In any case, thank you very much for trying this along with me! |
Beta Was this translation helpful? Give feedback.
-
While dbus is implemented for some time, systemd isn’t yet. There are workarounds and quite some articles about that available. It will come sooner or later officially (Ubuntu is working on that). |
Beta Was this translation helpful? Give feedback.
-
Good news @hansmbakker !
This is on Windows 10, WSL2 Ubuntu 20.04, with a "Pluggable" BCM2070 adapter. I followed yours and @dorssel 's directions to compile the kernel again with Bluetooth enabled. The directions are here: And I found it helpful to refer to this page: https://ubuntu.com/core/docs/bluez/reference/device-enablement/linux-kernel-configuration-options I also enabled the 2070 driver since I knew I would be using it. But it is my first time compiling using a Kconfig for Linux so YMMV. But at least I can use EDIT: the genie stuff is not needed, use init.d instead After installing genie according to the guide, I run From there I can use I will be attempting to use this as a documented development environment for people that don't want to use a traditional VM/Baremetal environment for this project: https://github.com/JPHutchins/gatter. So, I will be going through the process again on my colleague's W11 environment and I will try to document better. Thanks for all this amazing work! |
Beta Was this translation helpful? Give feedback.
-
Update: forget about the genie stuff and systemd.
At this point, assuming your USB device is attached to WSL2, you should be able to test with |
Beta Was this translation helpful? Give feedback.
-
I can confirm this worked 👍 After following the steps at https://github.com/dorssel/usbipd-win/wiki/WSL-support#building-your-own-usbip-enabled-wsl-2-kernel with the Bluetooth Low Energy option + its device drivers enabled, I had to
|
Beta Was this translation helpful? Give feedback.
-
I successfully got this working on a Windows 11 machine following these steps:
After this I was able to use |
Beta Was this translation helpful? Give feedback.
-
I almost got it working following many of the steps mentioned on this discussion, but it seems that my device (Intel AX210) is unsupported:
Doing some research, I have found this page: https://linux-hardware.org/?id=usb:8087-0032 Other diagnosis messages:
Here, the mac address is all zeroes, which made me suspect there was something wrong with the device and check it with
|
Beta Was this translation helpful? Give feedback.
-
The only thing I could think of would be adding in the intel specific BT
drivers using menuconfig. But the link you posted specifies that it only
needs BT and BTUSB.
I know it would be great to get it going, but FWIW I only use the
“Pluggable” brand BCM2070 adapter, at work and at home, as I’ve had
problems with laptop integrated chips even on bare metal Linux.
…On Sun, Mar 27, 2022 at 11:03 PM Diego Rodríguez Royo < ***@***.***> wrote:
I almost got it working following many of the steps mentioned on this
discussion, but it seems that my device (Intel AX210) is unsupported:
$ dmesg
...
[ 2069.671822] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[ 2069.674168] vhci_hcd vhci_hcd.0: devid(65543) speed(2) speed_str(full-speed)
[ 2069.678315] vhci_hcd vhci_hcd.0: Device attached
[ 2069.963972] vhci_hcd: vhci_device speed not set
[ 2070.033981] usb 1-1: new full-speed USB device number 4 using vhci_hcd
[ 2070.114036] vhci_hcd: vhci_device speed not set
[ 2070.184015] usb 1-1: SetAddress Request (4) to port 0
[ 2070.224538] usb 1-1: New USB device found, idVendor=8087, idProduct=0032, bcdDevice= 0.00
[ 2070.227404] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2070.234167] Bluetooth: hci0: Unsupported Intel hardware variant (23)
[ 2070.236502] vhci_hcd: unlink->seqnum 64
[ 2070.237239] vhci_hcd: the urb (seqnum 64) was already given back
[ 2070.238433] vhci_hcd: unlink->seqnum 65
[ 2070.239043] vhci_hcd: the urb (seqnum 65) was already given back
Doing some research, I have found this page:
https://linux-hardware.org/?id=usb:8087-0032
It says that the device is supported by kernel versions 5.8 and newer, so
I don't know what should I do.
Other diagnosis messages:
$ sudo hciconfig dev
hci0: Type: Primary Bus: USB
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:15 acl:0 sco:0 events:1 errors:0
TX bytes:3 acl:0 sco:0 commands:1 errors:0
Here, the mac address is all zeroes, which made me suspect there was
something wrong with the device and check it with $ dmesg
$ sudo hciconfig hci0 up
Can't init device hci0: Invalid argument (22)
$ bluetoothctl
Agent registered
[bluetooth]# scan on
No default controller available
—
Reply to this email directly, view it on GitHub
<#310 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIESQLVOG3Y5D5KZEYM3TQTVCFDRLANCNFSM5RENH64Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I grabbed an AX210 adapter and tried myself... I added only the following to the kernel
This is just a proof-of-concept since I don't need bluetooth for my use cases. |
Beta Was this translation helpful? Give feedback.
-
Hey!
As start dbus and bluetooth services is required every time that the bluetooth is connected to WSL added an alias at the end of ~/.bashrc so it is easy to start working with bluetooth: |
Beta Was this translation helpful? Give feedback.
-
I've made a guide by cloning and modifying the wiki from this repository and updating it to an another repository as I'm not a collaborator. |
Beta Was this translation helpful? Give feedback.
-
If you have an Intel AX211 adapter (device ID 8087:0033 - mine came with a Dell Precision 5570), you will need to use a newer Linux kernel than available from https://github.com/microsoft/WSL2-Linux-Kernel. I downloaded 5.15.55 from https://kernel.org, copied |
Beta Was this translation helpful? Give feedback.
-
Hi, Would WSL2 Bluetooth support work on Windows 10 (not Windows 11) ? |
Beta Was this translation helpful? Give feedback.
-
Yes.
…On Thu, Sep 22, 2022 at 2:06 AM toncho11 ***@***.***> wrote:
Hi,
Would WSL2 Bluetooth support work on Windows 10 (not Windows 11) ?
—
Reply to this email directly, view it on GitHub
<#310 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIESQLTHYWH2HFCHJZHUXXLV7QOSHANCNFSM5RENH64Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi, So USB support is compiled in the kernel, but I still need to re-compile the kernel to enable Bluetooth? Is that correct? Currently I get this error:
|
Beta Was this translation helpful? Give feedback.
-
Hi all! Sorry to revisit this after so long but I am attempting to attach my built-in Bluetooth adapter. I have followed the steps @JPHutchins and am unfortunately left with the following error: Below are some screenshots and information which might be useful for debugging
I have tried the modprobe commands mentioned by @sparklerfish but am let with the following error for
Any ideas on what I might be doing wrong? |
Beta Was this translation helpful? Give feedback.
-
I put together a script that fully automates this. I needed to do this with a .NET app where Docker Desktop is using the WSL2 backend and I need my Linux .NET docker container to be able to run bluetooth. There is some stuff I haven't seen in my scenario discussed elsewhere like the fact that I needed to execute the app from Visual Studio 2022 so the usual instructions of volume mapping and network host would not work for me so I put together a repo once I had it solved in hopes that it would help someone else. |
Beta Was this translation helpful? Give feedback.
-
Little update here. I hadn't needed this for a long time and decided to try again. When I installed WSL2 w/ Ubuntu 22.04, it used the kernel that I had compiled before. Kernel:
My Thinkpad has an Intel AX200 built in. Apparently they put it on a USB bus, yay!
Install bluez:
Try it out:
Well, I'm very surprised and very happy! Things that have changed?
|
Beta Was this translation helpful? Give feedback.
-
I am trying to use a Realtek-8761BU-based adapter (TP-Link UB500 Adapter), and cannot get this to work with your instructions. I compiled my own kernel enabling the bluetooth stack as described by others in this thread, but when attaching the USB device (or every time I unload and reload the btusb module) I get the following in dmesg:
I do have the file there in the distro I'm working from:
I tried downloading it from the linux-firmware tree, and also installing the What am I missing? |
Beta Was this translation helpful? Give feedback.
-
For anyone interested, I've created a fork of the Microsoft WSL2 kernel, https://github.com/dathpo/wsl2-linux-kernel, with the default branch set to WSL's current Linux version (5.15). It includes Bluetooth support through a commit that generates the kernel as an artifact using GitHub Actions. You can download the kernel file directly and deploy it by following the instructions in the README (top section). |
Beta Was this translation helpful? Give feedback.
-
I followed the v6 kernel build instructions here: Turned on a bunch of BT options as this thread suggests |
Beta Was this translation helpful? Give feedback.
-
Hi,
But now I am stuck at the following:
The error is probably a result of:
But when I look at Any ideas regarding the problems with rfkill and the file not being found? |
Beta Was this translation helpful? Give feedback.
-
I would like to use my laptop's bluetooth module from inside WSL2. I can attach the device as shown below, but bluetooth support in Ubuntu 20.04 (WSL) seems missing. Also I read that kernel recompilation might be needed if the WSL kernel doesn't support a device.
Has anybody gotten a bluetooth adapter working inside WSL2? (a lot of people here would be helped: microsoft/WSL#242)
output from
Beta Was this translation helpful? Give feedback.
All reactions