Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 ██╗      █████╗ ██╗      █████╗
 ██║     ██╔══██╗██║     ██╔══██╗
 ██║     ███████║██║     ███████║
 ██║     ██╔══██║██║     ██╔══██║
 ███████╗██║  ██║███████╗██║  ██║
 ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝

android-bt-diag

When Bluetooth dies after a kernel flash, the log already knows why.

Python Deps Platform License


Flash a custom kernel on a Qualcomm device and Bluetooth stops working. The device still boots, Wi-Fi still connects, and the only clue is a few lines buried in dmesg that scroll past before Android finishes starting. Reading them means an ADB session, a working USB driver, and knowing which of the six common failure modes you are looking at.

This repo gives you two things:

  1. A Magisk module that captures the Bluetooth bring-up state at early boot — before the logs rotate — and dumps it to /sdcard/bt-logs/. No PC needed.
  2. A log analyzer that reads those logs and tells you which failure it is, with evidence and a concrete fix.

Verified on POCO X3 NFC (surya / SM7150) with kernel 4.14.117-perf; the failure patterns are generic Qualcomm hci_qca / WCN3990 and apply across the family.

Failure modes it detects

Code What it means
MODUL_HILANG Kernel cannot find hci_qca.ko (ENOENT, probe -2). The driver file is gone.
DEVICE_HILANG UART ttyHS0 missing at probe (-19). Driver has nothing to attach to.
VERMAGIC_MISMATCH Module was signed for a different kernel, or CONFIG_MODULE_SIG_FORCE is on.
ABI_MISMATCH disagrees about version of symbol — the module was built against another kernel.
FIRMWARE_GAGAL WCN3990 rampatch failed or timed out — firmware blobs missing after a ROM swap.
RFKILL_KOSONG /dev/rfkill absent — CONFIG_RFKILL is not in the kernel config.

Each hit comes with the raw log line as evidence and a specific fix.

Quick start

1. Collect (on device)

Install magisk-module/ as a Magisk module (or flash the ZIP), reboot, then pull:

adb pull /sdcard/bt-logs
# or just copy the folder off the phone

Without Magisk, the analyzer also accepts a folder you assembled by hand containing dmesg-bt.txt, lsmod.txt, logcat-bt.txt, and friends.

2. Analyze (anywhere)

git clone https://github.com/Coding-No/android-bt-diag
cd android-bt-diag

./run.sh /path/to/bt-logs          # Linux / macOS / Termux / Kali
src\android-bt-diag.bat C:\path\to\bt-logs
python3 src/android_bt_diag/analyze.py /path/to/bt-logs   # any platform

Accepts either an extracted directory or the ZIP the collector produces.

Sample output

── ERROR TERDETEKSI ──

  [1] MODUL_HILANG
      MASALAH : Kernel tidak menemukan file modul hci_qca.ko (ENOENT).
      BUKTI   : hci_qca: probe of 1c00000.serial failed with error -2
      SOLUSI  : Copy hci_qca.ko dari ROM asli ke /vendor/lib/modules/, lalu insmod manual.

  [2] RFKILL_KOSONG
      MASALAH : /dev/rfkill tidak dibuat kernel — Bluetooth stack Android wajib butuh ini.
      BUKTI   : rfkill_init failed
      SOLUSI  : Kernel harus punya CONFIG_RFKILL=y. Reflash kernel dengan config itu.

Install the analyzer on PATH (optional)

pip install .        # or: pipx install .
android-bt-diag /path/to/bt-logs

Requirements

Analyzer: Python 3.8+. Nothing else, ever — no pip install, no adb. Collector: Magisk (or a rooted device using the manual file list).

Limitations

Read this before filing an issue:

  • Pattern matching, not magic. The analyzer matches known Qualcomm hci_qca / WCN3990 failure signatures. An unfamiliar failure mode is reported as "no known pattern" rather than guessed at.
  • Verified on one device family. The module targets Qualcomm (surya/SM7150 confirmed). Other SoCs (MediaTek, Exynos) have different Bluetooth stacks and are not covered.
  • Collector needs root. Non-Qualcomm paths may not exist; missing files show as HILANG instead of a false pass.
  • It does not repair anything. It reads logs and prints a diagnosis. Flashing modules and copying kernel blobs stays manual, on purpose.

Author

LALA — github.com/Coding-No

License

MIT — see LICENSE.

About

Qualcomm Bluetooth bring-up diagnostics — Magisk collector + stdlib log analyzer.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages