-
Notifications
You must be signed in to change notification settings - Fork 298
Description
BlueDucky currently contains a logic error around line ~662.
The script checks for paired Bluetooth devices instead of checking whether a Bluetooth adapter (hci0) exists and is running.
This causes the script to incorrectly print:
CRITICAL: No Compatible Bluetooth devices are connected.
even when your adapter is working normally.
This guide shows how to fix the bug.
✔️ What’s Wrong
The original code runs:
result = subprocess.run(['bluetoothctl', 'devices'], capture_output=True, text=True)
if "Device" not in result.stdout:
print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.")
return Falsebluetoothctl devices only lists paired devices.
If you have no paired devices, it falsely thinks you have no Bluetooth adapter.
✔️ Correct Fix
Replace the above block with:
# Check if hci0 exists and is up
result = subprocess.run(['hciconfig'], capture_output=True, text=True)
if "hci0:" not in result.stdout or "UP RUNNING" not in result.stdout:
print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Bluetooth adapter detected or not running.")
return FalseThis checks for the actual adapter (hci0) being present and active.
📌 Step-by-Step Tutorial
1. Go to your BlueDucky directory
cd ~/BlueDucky2. Make a backup
cp BlueDucky.py BlueDucky.py.bak3. Open the file
nano BlueDucky.py4. Find the faulty block
Scroll to the section near line ~662.
You’ll see something like:
# List devices to see if any are connected
result = subprocess.run(['bluetoothctl', 'devices'], capture_output=True, text=True)
if "Device" not in result.stdout:
print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.")
return False5. Replace it with the corrected logic
Paste this in its place:
# Check if hci0 exists and is up
result = subprocess.run(['hciconfig'], capture_output=True, text=True)
if "hci0:" not in result.stdout or "UP RUNNING" not in result.stdout:
print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Bluetooth adapter detected or not running.")
return False6. Save and exit
- Press
Ctrl + O, thenEnter - Press
Ctrl + X
7. Test
Check that your adapter exists:
hciconfigThen run BlueDucky again:
sudo python3 BlueDucky.pyYou should no longer get the misleading “No Compatible Bluetooth devices” error.
📌 Summary
Before: Script checks for paired devices → false error.
After: Script checks for actual adapter state → correct behavior.