Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth not supported (Built-in and USB-BT Adapter) #242

Open
Fleker opened this issue Apr 21, 2016 · 39 comments
Open

Bluetooth not supported (Built-in and USB-BT Adapter) #242

Fleker opened this issue Apr 21, 2016 · 39 comments
Labels
feature wsl2 Issue/feature applies to WSL 2

Comments

@Fleker
Copy link

Fleker commented Apr 21, 2016

I am interested in running and accessing bluetooth through Bash. However, after trying to use the laptop's Bluetooth chip and a USB adapter, both of which support BT 4.0, it seems like this is not supported.

root@localhost:/mnt/c/Users/guest1# sysv-rc-conf bluetooth on
root@localhost:/mnt/c/Users/guest1# sysv-rc-conf -list | grep bluetooth
    bluetooth    2:on       3:on    4:on    5:on
root@localhost:/mnt/c/Users/guest1# hcitool scan
    Device is not available: Address family not supported by protocol
root@localhost:/mnt/c/Users/guest1# service bluetooth start
    * Starting bluetooth                                                           Can't start daemon: No such device
    Can't open RFCOMM control socket: Address family not supported by protocol
                                                                     [ OK ]

Is there some property that I need to add in order for Bluetooth to be accessible, or is it due to a lack of permissions and accessibility to my hardware?

@benhillis
Copy link
Member

Thanks for reporting this, currently we do not expose hardware to the Linux subsystem. I would suggest filing a request on our user voice page so we can prioritize this work.

Thanks!
Ben

@jstarks
Copy link
Member

jstarks commented Nov 19, 2017

Tracking feature requests via user voice.

@jstarks jstarks closed this as completed Nov 19, 2017
@TomasHubelbauer
Copy link

For anyone who lands here from Google, the Bluetooth support request would be:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-windows-subsystem-for-l/suggestions/33277174-add-suppor-to-bluetooth-on-wsl

Someone in the comments says there is a more general hardware access request, but in the top ones, all I see are specific file systems, USB, graphics related stuff etc. requests, nothing mentioning Bluetooth among other hardware in a general hardware request, so I think it's better to vote for BT access directly through the above link.

@AgainPsychoX
Copy link

So, there is WSL 2. Is the Bluetooth available now?

@kant2002
Copy link

kant2002 commented Oct 7, 2019

UserVoice is closed. Can this issue be reopened here?

@therealkenc therealkenc reopened this Mar 10, 2020
@therealkenc therealkenc added the wsl2 Issue/feature applies to WSL 2 label Mar 10, 2020
@therealkenc
Copy link
Collaborator

therealkenc commented Mar 10, 2020

This is one of the features requests that closed while UserVoice was still around. See also #237, which unlike this issue, remained arbitrarily open.

A little context, [edit] there are no sound devices let alone bluetooth devices in Hyper-V (the basis of WSL2). If or when sound (playback and recording) is implemented in WSL it would almost certainly happen a layer or two up, just like how sound works in most VMs.

Which is to say, the OP hcitool scan is very probably not going to return anything for the foreseeable. Such a thing (call it "bluetooth radio device passthrough") is possible in the very abstract hypothetical (see for example this analogy), especially if we get USB ref #2195. But that's probably not how this is going to go down. For now, for sound, "stay tuned" (see what I did there?) and hit thumbs-up on #237 (for lack of a better landing zone for "sound devices"). The devs are aware that sound was a highly voted request on UserVoice. In the meantime ref #486 is a viable "layer or two up" alternative for the highly motivated, or at least was last time I looked a very long time ago.

@casperfrx
Copy link

Any new updates on this feature request?

@steffennilsen
Copy link

running into the same issue, rfcomm isn't exposed

@heezes
Copy link

heezes commented Jan 15, 2021

@therealkenc Are there any plans to add tBluetooth support to wsl?

@wijjj
Copy link

wijjj commented Jan 29, 2021

If there is any update on this, I would much appreciate it. :)

@ranjithmkumar1992
Copy link

Please provide hardware access to network interfaces and serial port access in this IoT era.

@sam0x17
Copy link

sam0x17 commented May 10, 2021

Please add bluetooth support

@dharders
Copy link

Pretty excited for WSL2... tried out features....looking good until tried bluetooth hw access... nope!

Please add bluetooth support, this issue has been open since 2016 !

@FranzHahn
Copy link

I'd really welcome BT support.

@mhnsn
Copy link

mhnsn commented Jun 17, 2021

Considering the major industry push for Edge AI and the prevalence of both Linux and BT within the field, this is a pretty serious pain point right now. Lack of hardware access in WSL is a crippling problem for rigorous development and testing.

@buff0k
Copy link

buff0k commented Jun 30, 2021

Adding to the above, there are a miriad enterprise use cases where direct hardware access, including BT is required to have functional access to infrastructure, this is a major flaw in the current WSL2 deployment which should see attention if WSL2 is to become useable as a real alternative to dual booting

@mehdishn
Copy link

Is there any way to get a BT dongle to work in WSL2 right now?

@Devnol
Copy link

Devnol commented Nov 10, 2021

USB passthrough support is finally here and following this xda article I have managed to pass my bluetooth adapter through to WSL. However, hciconfig etc. fail with errors similar to the following:

$ bluetoothctl
Waiting to connect to bluetoothd...dbus[2033]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.

modprobing bluetooth also fails since apparently there are no kernel modules in WSL at all, shown by empty output from lsmod.

Bluetooth on wsl would be really useful especially in situations where low level access to bluetooth hardware is required.

@MDHEXT
Copy link

MDHEXT commented Dec 6, 2021

USB passthrough support is finally here and following this xda article I have managed to pass my bluetooth adapter through to WSL. However, hciconfig etc. fail with errors similar to the following:

$ bluetoothctl
Waiting to connect to bluetoothd...dbus[2033]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.

modprobing bluetooth also fails since apparently there are no kernel modules in WSL at all, shown by empty output from lsmod.

Bluetooth on wsl would be really useful especially in situations where low level access to bluetooth hardware is required.

that, and LDAC support through WSL. (Too bad windows probably won't add it any time soon.)

@hansmbakker
Copy link

USB passthrough support is finally here and following this xda article I have managed to pass my bluetooth adapter through to WSL. However, hciconfig etc. fail with errors similar to the following:

$ bluetoothctl
Waiting to connect to bluetoothd...dbus[2033]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.

modprobing bluetooth also fails since apparently there are no kernel modules in WSL at all, shown by empty output from lsmod.

Bluetooth on wsl would be really useful especially in situations where low level access to bluetooth hardware is required.

I tried a bit further from there with assistance from @dorssel in dorssel/usbipd-win#278.
I built a custom WSL2 kernel with support for bluetooth and bluetooth drivers. However, unfortunately that still does not make it work...

@lookbothways
Copy link

I'm trying to find a way to reduce Bluetooth audio lag in Windows 10. I'm running out of options (clearly, or I'd not be considering WSL to solve this) - if Bluetooth audio was somehow able to be piped through WSL (and hopefully better drivers) would this be some way to get latency down? It's currently ~150ms, which makes everything look dubbed.

The hardware (XPS 9510 with soldered-on Killer ax1650s) works perfectly with minimal latency when I use Linux Mint.

@ivan2angelov
Copy link

I would like to access Bluetooth HW of my laptop via WLS2. How can I do that? The question was asked in April 2016 and still no support?

@JPHutchins
Copy link

JPHutchins commented Mar 14, 2022

I have passed a "Pluggable" BCM 2070 Bluetooth USB dongle from Windows 10 to WSL2 5.10.60.1-microsoft-standard-WSL2+ using the tools:

https://github.com/dorssel/usbipd-win
https://github.com/arkane-systems/genie have since found that this is not needed

Follow and contribute to the thread here as we document and refine: dorssel/usbipd-win#278 (comment)

@hansmbakker
Copy link

@JPHutchins that's super useful, thanks for sharing!

@ WSL2 team - please keep this issue still on your backlog until this is integrated in WSL2 as currently it requires a lot of manual steps and complexity.

@JPHutchins
Copy link

JPHutchins commented Mar 20, 2022

I have a branch of the WSL2 KConfig repo that includes the necessary KConfig defaults so that users will not have to clone and recompile the kernel themselves. These changes are relatively low risk since Bluetooth will be compiled as a module. Even with this kernel the user must manually 1) modprobe btusb 2) start dbus and bluetooth as services to opt into the feature, not to mention setting up USBIPD.

Unfortunately I do not have permissions to open the PR myself. Microsoft and people that want to compile themselves can pull in these changes from here: https://github.com/JPHutchins/WSL2-Linux-Kernel/tree/feature/usb/bluetooth

@hansmbakker
Copy link

It's great that you want to share the settings. One question though: why did you chose to compile them as modules vs "built-in"?

Other devices are loaded automatically, so I guess they are "built-in"? At least I didn't notice modprobe is needed for them.

Or does Ubuntu normally modprobe these modules using a script when starting the Bluetooth service?

(Maybe I misunderstood how this works - if so, please ignore this)

@JPHutchins
Copy link

The idea is to make it less risky. I get the feeling that 99.99% of WSL users don't need HW pass through, let alone Bluetooth, so including them as modules should minimize bugs for those users. Bugs for BT users will be easily identified since the user would have manually loaded the kernel module.

However, since I can't PR, if users are compiling themselves they should absolutely just use menuconfig and include them.

I am new to this and don't really understand how Ubuntu deals with it. I copied the options from Ubuntu which does do "default m". However, I don't remember ever having to modprobe btusb on Ubuntu, VM or bare metal. So, I have two theories: at OS install time it checks hardware and decides to load Bluetooth and btusb or at bluez installation it loads Bluetooth and btusb.

There is still the problem of bluez installation not adding the BLUETOOTH_ENABLED at /etc/defaults/bluetooth but that's an easy config step compared to cloning, modifying and recompiling your own kernel.

At any rate, I'll just release the compiled kernel (with btusb included) from my fork and test it across a few machines to see if that works. That's potentially a two-minute fix instead of a 30-minute fix.

@Diegorro98
Copy link

@JPHutchins I tried to get Bluetooth support by cloning your fork, and right after that (and after installing dependencies) I compiled the kernel with $ make KCONFIG_CONFIG=Microsoft/config-wsl (Do I need to do this or it is already compiled? Because you said that "users will not have to clone and recompile the kernel themselves").

After that I copied the bzImage to Windows and referenced it on .wslconfig file, then, after a WSL reboot, I checked that WSL was using that kernel with $ uname -a.
Then, you said the following:

Even with this kernel the user must manually 1) modprobe btusb 2) start dbus and bluetooth as services to opt into the feature, not to mention setting up USBIPD.

But I'm stuck on the first step, I have the following output:

$ sudo modprobe btusb
modprobe: ERROR: could not insert 'btusb': Unknown symbol in module, or unknown parameter (see dmesg)

and dmesg says:

$dmesg
...
[  480.027460] btintel: Unknown symbol __regmap_init (err -2)

I'm able to start dbus and bluetooth services (last one I couldn't but I installed bluez and it worked)

Any idea about how to solve this problem?

@JPHutchins
Copy link

@Diegorro98 Good point, you DO have to compile it for now. If Microsoft merged and released you wouldn't.

That branch is intended as something mergeable to WSL2 main. You'd probably prefer to run menuconfig first and select what you need.

Try this to compile the kernel:

sudo make -j 8 && sudo make modules_install -j 8 && sudo make install -j 8

Refer to the guide here: https://github.com/dorssel/usbipd-win/wiki/WSL-support#building-your-own-usbip-enabled-wsl-2-kernel

@nstrelow
Copy link

Hey, has there been progress on this in the last months?

@JPHutchins
Copy link

Hey, has there been progress on this in the last months?

From Microsoft? Not that I know of. Bluetooth works in WSL2 using USBIPD, but you'll probably have to compile the kernel in order to add BT or get a compatible one from someone. See the info over at the USBIPD project.

@dezza
Copy link

dezza commented Oct 27, 2022

It would be nice if it was just enabled so people don't have to compile their own kernel.

@czanoli
Copy link

czanoli commented Dec 1, 2022

@JPHutchins I followed your tutorial:

[https://github.com/dorssel/usbipd-win/wiki/WSL-support#building-your-own-usbip-enabled-wsl-2-kernel]

However, I'm stuck at the following command:
cp arch/x86/boot/bzImage /mnt/c/Users/<user>/usbip-bzImage

In ~/WSL2-Linux-Kernel/arch/x86/boot/ there is no bzImage file

What am I doing wrong? :(

@wijjj
Copy link

wijjj commented Jan 23, 2023

Aight, got rid of Microsoft Windows entirely. Case closed for me. Thanks anyways for the effort.

@Adesanya-Toba
Copy link

@JPHutchins I followed your tutorial:

[https://github.com/dorssel/usbipd-win/wiki/WSL-support#building-your-own-usbip-enabled-wsl-2-kernel]

However, I'm stuck at the following command: cp arch/x86/boot/bzImage /mnt/c/Users/<user>/usbip-bzImage

In ~/WSL2-Linux-Kernel/arch/x86/boot/ there is no bzImage file

What am I doing wrong? :(

@Superzano, I had the same issue. Were you able to fix it or did you drop it?
I think it might be related to the version of the kernel (linux-msft-wsl-5.15.y).

@fanyx-ok
Copy link

Can WSL2 support usb bluetooth adapter? I attach one to WSL2, but not worked.
I reading all comments in this issue, so, there is no normal way to let WSL2 connect to a bluetooth device, right?

@niiiksh
Copy link

niiiksh commented Sep 13, 2023

Just use Mac. Microsoft is just a greedy company with nothing working the right way.

@xAstroBoy
Copy link

Just use Mac. Microsoft is just a greedy company with nothing working the right way.

Not true, windows is more friendly than a MacOS with apple being greedy with their customers being limited only to their operative system .

Any progress regarding bluetooth?

@fanyx-ok
Copy link

Just use Mac. Microsoft is just a greedy company with nothing working the right way.

Not true, windows is more friendly than a MacOS with apple being greedy with their customers being limited only to their operative system .

Any progress regarding bluetooth?

In development and testing, sometimes needs to send specific commands to bluetooth only RF device, for example, arm m serial chip target, while toolchain of them are windows only.

The problem is windows's development tool of bluetooth is not easy to write and use, also not stable and fast.

If wsl2 contains bluetooth functionality, it would be a good solution for combining linux dev&& test env and windows toolchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature wsl2 Issue/feature applies to WSL 2
Projects
None yet
Development

No branches or pull requests