Learn: Sharing Bluetooth devices for use inside WSL2

Bluetooth_image

Prompt: Bluetooth device connecting to computer cartoon style

Introduction

This short writeup summarizes my experience in enabling bluetooth device pass through for WSL2 usage. In the future, newer WSL kernels may support this feature out of the box and this guide may get outdated.

Pre-requisites

  1. WSL2 running on your device
  2. USBIPD - Link to repo
  3. Supported bluetooth device (Tested on Intel AX200)
  4. Backup of your current WSL2 (Just in case things go wrong)

Steps

  1. Update Kernel Follow this guide until step 4, right before building the kernel (since we will need to modify the configurations before continuing)
  2. Install bluetooth libraries via menuconfig

    via your Terminal:

    Menuconfig_entry

    Select Networking Support via pressing Enter:

    Menuconfig_0

    Enable Bluetooth subsystem support via pressing Y:

    Menuconfig_1

    Enable the relevant Bluetooth support as follows:

    Menuconfig_2

    Go to Bluetooth device drivers (last entry) and enable the following:

    Menuconfig_3

    Continue following the Microsoft guide until the end. NOTE: Building the kernel will take a few minutes depending on your system.

  3. Pass in bluetooth device

    sudo apt update
    sudo apt install bluez dbus
    echo ‘export BLUETOOTH_ENABLED=1’ | sudo tee /etc/default/bluetooth

  4. Start bluetooth services

    sudo service dbus start
    sudo service bluetooth start
    bluetoothctl
    scan on

    bluetooth_usage

  5. Enjoy! For my use case, I am using it to commission Matter devices via the CHIP Tool.

    chip-tool

Resources