@@ -5832,8 +5832,7 @@ def start_bt_scan():
)
elif scan_mode == 'bluetoothctl':
- # Use bluetoothctl for scanning with stdbuf to unbuffer output
- # Or use script command to provide a pty
+ # Use bluetoothctl for BLE scanning with pty for proper output
import pty
import os
@@ -5850,7 +5849,12 @@ def start_bt_scan():
# Store master_fd for reading
bt_process._master_fd = master_fd
- # Send scan on command
+ # Wait for bluetoothctl to initialize
+ time.sleep(0.5)
+
+ # Power on and start LE scan (compatible with Bluetooth 5.x)
+ os.write(master_fd, b'power on\n')
+ time.sleep(0.3)
os.write(master_fd, b'scan on\n')
elif scan_mode == 'ubertooth':