Skip to content

Latest commit

ย 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MediaTek MT7922 Bluetooth Fix for Linux

๐Ÿ”ง Complete solution for MediaTek MT7922 Bluetooth connectivity issues on Linux systems

๐Ÿ“‹ Table of Contents

๐Ÿšจ Problem Description

Many modern laptops ship with MediaTek MT7922 wireless adapters that combine WiFi and Bluetooth functionality. While WiFi typically works out-of-the-box on Linux distributions, Bluetooth often fails with these symptoms:

Common Issues:

  • โŒ "No default controller available" in bluetoothctl
  • โŒ No Bluetooth option in system settings
  • โŒ Empty output from bluetoothctl list
  • โŒ Hardware detected by lsusb but non-functional Bluetooth
  • โŒ Bluetooth works intermittently or stops after suspend

Root Causes:

  • Missing or incorrect Bluetooth firmware
  • Improper driver binding (btusb/btmtk)
  • USB power management issues
  • Wrong kernel module loading order
  • Outdated Linux kernel (<6.10)

๐Ÿš€ Quick Fix

Prerequisites

# Check your hardware
lsusb | grep -i mediatek
lspci | grep -i mediatek

# Check kernel version (6.10+ recommended)
uname -r

One-Command Fix

wget -O - https://raw.githubusercontent.com/mohdsami91/mt7922-bluetooth-fix/main/bluetooth_troubleshoot_script.sh | bash

Or download and run manually:

git clone https://github.com/mohdsami91/mt7922-bluetooth-fix.git
cd mt7922-bluetooth-fix
chmod +x bluetooth_troubleshoot_script.sh
./bluetooth_troubleshoot_script.sh

๐Ÿ“„ Scripts Included

1. bluetooth_troubleshoot_script.sh

Main fix script - Comprehensive automated solution

Features:

  • โœ… Hardware detection and validation
  • โœ… Automatic firmware download and installation
  • โœ… Module loading and service restart
  • โœ… USB power management fixes
  • โœ… RFKILL unblocking
  • โœ… Status verification and reporting

Usage:

./bluetooth_troubleshoot_script.sh

2. bluetooth_diagnostic_commands.sh

Advanced diagnostics - Deep hardware and driver analysis

Features:

  • ๐Ÿ” Detailed hardware detection
  • ๐Ÿ” Driver binding analysis
  • ๐Ÿ” Firmware status checking
  • ๐Ÿ” USB interface examination
  • ๐Ÿ” Kernel message analysis

Usage:

./bluetooth_diagnostic_commands.sh

3. mt7922_bluetooth_fix.sh

Legacy fix script - Basic firmware and module management

Usage:

./mt7922_bluetooth_fix.sh

4. kernel_upgrade_script.sh

Kernel upgrade helper - For systems with older kernels

Usage:

./kernel_upgrade_script.sh

๐Ÿ› ๏ธ Manual Solutions

If scripts don't work, try these manual fixes:

Fix 1: Force Driver Binding

# Get your device Product ID
lsusb | grep -i mediatek

# Force bind to btusb driver (replace XXXX with your product ID)
echo '0e8d XXXX' | sudo tee /sys/bus/usb/drivers/btusb/new_id

Fix 2: Manual Firmware Installation

# Download latest firmware
cd /tmp
wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin

# Install firmware
sudo mkdir -p /lib/firmware/mediatek
sudo cp BT_RAM_CODE_MT7922_1_1_hdr.bin /lib/firmware/mediatek/

# Reload modules
sudo modprobe -r btusb btmtk
sudo modprobe btmtk
sudo modprobe btusb

Fix 3: USB Power Management

# Disable USB auto-suspend for MediaTek devices
for device in /sys/bus/usb/devices/*/idVendor; do
    if [ -f "$device" ] && [ "$(cat $device)" = "0e8d" ]; then
        echo 'on' | sudo tee $(dirname $device)/power/control
    fi
done

Fix 4: Module Loading Order

# Load modules in correct order
sudo modprobe -r btusb btmtk btintel btrtl
sudo modprobe bluetooth
sudo modprobe btmtk
sudo modprobe btusb
sudo systemctl restart bluetooth

๐Ÿ–ฅ๏ธ Supported Hardware

Device Vendor ID Product ID Status
MT7922 0e8d 7961 โœ… Supported
MT7922 0e8d 7922 โœ… Supported
MT7921 0e8d 7961 โš ๏ธ Limited

Tested Systems:

  • Linux Mint 21.3+ โœ…
  • Ubuntu 22.04+ โœ…
  • Pop!_OS 22.04+ โœ…
  • Kernel 6.14+ โœ… (Full support)
  • Kernel 6.10-6.13 โš ๏ธ (Partial support)
  • Kernel <6.10 โŒ (Not supported)

๐Ÿ“ฆ Installation

Clone Repository

git clone https://github.com/mohdsami91/mt7922-bluetooth-fix.git
cd mt7922-bluetooth-fix

Make Scripts Executable

chmod +x *.sh

๐ŸŽฎ Usage

Step 1: Run Diagnostics (Optional)

./bluetooth_diagnostic_commands.sh

This will show detailed information about your hardware and help identify specific issues.

Step 2: Apply Main Fix

./bluetooth_troubleshoot_script.sh

This script will attempt to fix most common issues automatically.

Step 3: Reboot

sudo reboot

Step 4: Test Bluetooth

# Check if controller is detected
bluetoothctl list

# Start scanning for devices
bluetoothctl
power on
agent on
default-agent
scan on

๐Ÿ”ง Troubleshooting

Still Not Working?

  1. Check kernel version:

    uname -r
    # If < 6.10, run: ./kernel_upgrade_script.sh
  2. Verify hardware detection:

    lsusb | grep -i mediatek
    dmesg | grep -i bluetooth | tail -10
  3. Check firmware loading:

    dmesg | grep -i firmware
    ls -la /lib/firmware/mediatek/
  4. Manual USB reset:

    sudo usb_modeswitch -v 0e8d -p XXXX --reset-usb

Common Error Messages:

Error Solution
"No default controller available" Run bluetooth_troubleshoot_script.sh
"Operation not permitted" Check RFKILL: sudo rfkill unblock all
"Firmware loading failed" Manual firmware installation (see above)
"Device not found" USB power management fix

๐Ÿ“š Educational Resources

This repository also includes educational materials for understanding Linux Bluetooth driver development:

Driver Development Template

  • mt7922_bluetooth.c - Basic driver structure (educational only)
  • Makefile - Build system for kernel modules
  • Driver development documentation

โš ๏ธ Note: These are for learning purposes only. For production use, always use the existing btmtk kernel driver.

Learning Resources:

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

Reporting Issues

  1. Run ./bluetooth_diagnostic_commands.sh
  2. Create an issue with the full output
  3. Include your system information:
    uname -a
    lsb_release -a
    lsusb | grep -i mediatek

Adding Support for New Hardware

  1. Fork the repository
  2. Test scripts on your hardware
  3. Update hardware compatibility table
  4. Submit a pull request

Code Contributions

  1. Follow existing script structure
  2. Add error handling and logging
  3. Test on multiple distributions
  4. Update documentation

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Linux kernel developers working on MediaTek support
  • Community members who reported and tested fixes
  • MediaTek

About

This repository provides diagnostic tools and fixes for MediaTek MT7922 wireless adapters that experience Bluetooth connectivity issues on Linux distributions, particularly when encountering the "no default controller available" error.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages