diff --git a/templates/index.html b/templates/index.html
index 8bd6a1a..7bcdd5c 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -5796,13 +5796,22 @@
let btRadarAnimFrame = null;
let btRadarDevices = [];
- // Refresh Bluetooth interfaces
+ // Refresh Bluetooth interfaces (legacy - now handled by BluetoothMode.init())
function refreshBtInterfaces() {
+ // New Bluetooth mode uses /api/bluetooth/capabilities instead
+ // This function is kept for backwards compatibility but uses new API
+ if (typeof BluetoothMode !== 'undefined') {
+ BluetoothMode.checkCapabilities();
+ return;
+ }
+ // Legacy fallback (shouldn't be needed)
+ const select = document.getElementById('btInterfaceSelect') || document.getElementById('btAdapterSelect');
+ if (!select) return;
+
fetch('/bt/interfaces')
.then(r => r.json())
.then(data => {
- const select = document.getElementById('btInterfaceSelect');
- if (data.interfaces.length === 0) {
+ if (!data.interfaces || data.interfaces.length === 0) {
select.innerHTML = '';
} else {
select.innerHTML = data.interfaces.map(i =>
@@ -5810,13 +5819,16 @@
).join('');
}
- // Update tool status
+ // Update tool status (if element exists)
const statusDiv = document.getElementById('btToolStatus');
- statusDiv.innerHTML = `
- hcitool:${data.tools.hcitool ? 'OK' : 'Missing'}
- bluetoothctl:${data.tools.bluetoothctl ? 'OK' : 'Missing'}
- `;
- });
+ if (statusDiv) {
+ statusDiv.innerHTML = `
+ hcitool:${data.tools.hcitool ? 'OK' : 'Missing'}
+ bluetoothctl:${data.tools.bluetoothctl ? 'OK' : 'Missing'}
+ `;
+ }
+ })
+ .catch(err => console.warn('Legacy BT interface check failed:', err));
}
// Start Bluetooth scan
diff --git a/utils/bluetooth/fallback_scanner.py b/utils/bluetooth/fallback_scanner.py
index b7aec99..a8357b8 100644
--- a/utils/bluetooth/fallback_scanner.py
+++ b/utils/bluetooth/fallback_scanner.py
@@ -164,7 +164,7 @@ class BleakScanner:
manufacturer_data=manufacturer_data,
service_uuids=list(adv_data.service_uuids) if adv_data.service_uuids else [],
service_data=service_data,
- is_connectable=device.metadata.get('connectable', True) if hasattr(device, 'metadata') else True,
+ is_connectable=getattr(adv_data, 'connectable', True) if adv_data else True,
)