microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.23k stars 808 forks source link

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

Open Fleker opened 8 years ago

Fleker commented 8 years ago

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 commented 8 years ago

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 commented 6 years ago

Tracking feature requests via user voice.

TomasHubelbauer commented 5 years ago

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 commented 5 years ago

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

kant2002 commented 4 years ago

UserVoice is closed. Can this issue be reopened here?

therealkenc commented 4 years ago

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 commented 3 years ago

Any new updates on this feature request?

steffennilsen commented 3 years ago

running into the same issue, rfcomm isn't exposed

heezes commented 3 years ago

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

wijjj commented 3 years ago

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

ranjithmkumar1992 commented 3 years ago

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

sam0x17 commented 3 years ago

Please add bluetooth support

dharders commented 3 years ago

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 commented 3 years ago

I'd really welcome BT support.

mhnsn commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

Devnol commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 https://github.com/dorssel/usbipd-win/issues/278. I built a custom WSL2 kernel with support for bluetooth and bluetooth drivers. However, unfortunately that still does not make it work...

lookbothways commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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: https://github.com/dorssel/usbipd-win/issues/278#issuecomment-1066308372

hansmbakker commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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 commented 1 year ago

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

JPHutchins commented 1 year ago

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 commented 1 year ago

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

czanoli commented 1 year ago

@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 commented 1 year ago

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

Adesanya-Toba commented 1 year ago

@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 commented 12 months ago

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 commented 12 months ago

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

xAstroBoy commented 9 months ago

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 commented 9 months ago

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.