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

Built WSL do not include bluetooth controller of Mediatek #12048

Closed
1 of 2 tasks
HamzaHajeir opened this issue Sep 18, 2024 · 8 comments
Closed
1 of 2 tasks

Built WSL do not include bluetooth controller of Mediatek #12048

HamzaHajeir opened this issue Sep 18, 2024 · 8 comments
Labels
emailed-logs Logs have been emailed

Comments

@HamzaHajeir
Copy link

Windows Version

Microsoft Windows [Version 10.0.22621.4169]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.153.1-2

Distro Version

Ubuntu-24.04

Other Software

No response

Repro Steps

I have WSL and want to manage bluetooth from within it.

I've followed this instruction to build the custom WSL, including all the required checks into .config file.

Here's the latest .config file content that built the latest WSL firmware: https://pastebin.com/5CBrBf7c

And have used usbipd to share and attach the bluetooth device through:

  • usbipd bind --busid={BUSID}
  • usbipd attach --wsl --busid={BUSID}

Where both run successfully, and:

  • usbipd list gives:
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-9    0e8d:0608  RZ608 Bluetooth(R) Adapter                                    Attached
1-10   0b05:1939  AURA LED Controller, USB Input Device                         Not shared
2-3    045e:07a5  USB Input Device                                              Not shared
2-4    045e:0745  Microsoft Hardware USB Keyboard, USB Input Device             Not shared

Running bluetoothctl scan on result in No default controller available.

My finding concludes that btmtk module is missing within the system. And I don't know how to find/have/run it.

Expected Behavior

To successfully find and manage / interact with bluetooth device.

Actual Behavior

  • systemctl status bluetooth:
● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
     Active: active (running) since Mon 2024-09-16 00:05:39 +03; 19h ago
       Docs: man:bluetoothd(8)
   Main PID: 485 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 9470)
     Memory: 2.3M ()
     CGroup: /system.slice/bluetooth.service
             └─485 /usr/libexec/bluetooth/bluetoothd

Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support csip plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: profiles/audio/micp.c:micp_init() D-Bus experimental not enabled
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support micp plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support vcp plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support mcp plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support bass plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support bap plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: profiles/network/bnep.c:bnep_init() kernel lacks bnep-protocol support
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: src/plugin.c:plugin_init() System does not support network plugin
Sep 16 00:05:39 HamzaHajeir bluetoothd[485]: Bluetooth management interface 1.21 initialized
  • sudo dmesg | grep firmware:
[    0.051585] Spectre V2 : Enabling Restricted Speculation for firmware calls
[   25.755056] bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin failed with error -2
[   25.755059] Bluetooth: hci0: Failed to load firmware file (-2)
[   25.755504] Bluetooth: hci0: Failed to set up firmware (-2)
[26548.979065] bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin failed with error -2
[26548.979113] Bluetooth: hci0: Failed to load firmware file (-2)
[26548.980582] Bluetooth: hci0: Failed to set up firmware (-2)

Note I've followed [this procedure (#3)][2] to include BT_RAM_CODE_MT7961_1_2_hdr.bin and other files, adding all files.

Therefore:

  • ls -a /lib/firmware/mediatek | grep MT7961:
BT_RAM_CODE_MT7961_1_2_hdr.bin
BT_RAM_CODE_MT7961_1_2_hdr.bin.zst
BT_RAM_CODE_MT7961_1a_2_hdr.bin
BT_RAM_CODE_MT7961_1a_2_hdr.bin.zst
WIFI_MT7961_patch_mcu_1_2_hdr.bin
WIFI_MT7961_patch_mcu_1_2_hdr.bin.zst
WIFI_RAM_CODE_MT7961_1.bin
WIFI_RAM_CODE_MT7961_1.bin.zst
  • lsusb -v -s 001:003 (Note 003 is the corresponding device ID):
Bus 001 Device 003: ID 0e8d:0608 MediaTek Inc. Wireless_Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 [unknown]
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x0e8d MediaTek Inc.
  idProduct          0x0608 Wireless_Device
  bcdDevice            1.00
  iManufacturer           5 MediaTek Inc.
  iProduct                6 Wireless_Device
  iSerial                 7 000000000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00fe
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          8 Config_01
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass        224 Wireless
      bFunctionSubClass       1 Radio Frequency
      bFunctionProtocol       1 Bluetooth
      iFunction               4 BT_FUNCTION
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              1 BT_ACL_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       6
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              2 BT_SCO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x003f  1x 63 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x003f  1x 63 bytes
        bInterval               4
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              3 BT_ISO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x8a  EP 10 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x0a  EP 10 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              3 BT_ISO_If
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x8a  EP 10 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x0a  EP 10 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x000c
  bNumDeviceCaps          1
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000000
      (Missing must-be-set LPM bit!)
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled
  • hciconfig -a:
hci0:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:0 acl:0 sco:0 commands:0 errors:0
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DH1 HV1
        Link policy:
        Link mode: PERIPHERAL ACCEPT
  • rfkill Shows unblocked hard and software:
ID TYPE      DEVICE      SOFT      HARD
 1 bluetooth hci0   unblocked unblocked
  • lsmod | grep -i bt - This one which shows me that the module MTK module is missing:
btusb                  53248  0
btrtl                  24576  1 btusb
btbcm                  24576  1 btusb
btintel                36864  1 btusb
bluetooth             573440  11 btrtl,btintel,btbcm,btusb

And finally:

  • journalctl --dmesg --boot=-0 --grep blue
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: Core ver 2.22
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: Starting self testing
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: ECDH test passed in 2653 usecs
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: SMP test passed in 1100 usecs
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: Finished self testing
Sep 16 00:05:39 HamzaHajeir kernel: NET: Registered PF_BLUETOOTH protocol family
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: HCI device and connection manager initialized
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: HCI socket layer initialized
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: L2CAP socket layer initialized
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: SCO socket layer initialized
Sep 16 00:05:39 HamzaHajeir kernel: bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin failed with error -2
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: hci0: Failed to load firmware file (-2)
Sep 16 00:05:39 HamzaHajeir kernel: Bluetooth: hci0: Failed to set up firmware (-2)
Sep 16 19:56:59 HamzaHajeir kernel: bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin failed with error -2
Sep 16 19:56:59 HamzaHajeir kernel: Bluetooth: hci0: Failed to load firmware file (-2)
Sep 16 19:56:59 HamzaHajeir kernel: Bluetooth: hci0: Failed to set up firmware (-2)

Diagnostic Logs

No response

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

@HamzaHajeir
Copy link
Author

/emailed-logs

Copy link

Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 2, 2024

@HamzaHajeir: This is the kconfig flag that you need for that module: https://cateee.net/lkddb/web-lkddb/BT_MTK.html

@HamzaHajeir
Copy link
Author

@HamzaHajeir: This is the kconfig flag that you need for that module: https://cateee.net/lkddb/web-lkddb/BT_MTK.html

I've inserted that line into .config file, but that line gets automatically removed by the builder script somehow. Perhaps some incompatible config?

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 4, 2024

It might be. Unfortunately that's not something that can be solved from the WSL side.

Closing since the issue is about the Linux kernel config & build system.

@OneBlue OneBlue closed this as completed Oct 4, 2024
@HamzaHajeir
Copy link
Author

HamzaHajeir commented Oct 4, 2024 via email

@HamzaHajeir
Copy link
Author

But how is that not WSL issue while its scripts would do so?

@OneBlue

The menuconfig also does not show any related configuration to enable CONFIG_BT_MTK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emailed-logs Logs have been emailed
Projects
None yet
Development

No branches or pull requests

2 participants