remove trust from bluetoothctl pairing, filter node list

This commit is contained in:
agessaman 2025-10-13 21:20:03 -07:00
parent 6d652222a8
commit 388acea770
2 changed files with 16 additions and 13 deletions

View file

@ -273,9 +273,8 @@ async def attempt_pairing_linux(address, name, pin):
}), flush=True)
return False
# Trust the device
child.sendline(f'trust {address}')
child.expect('trust succeeded')
# Note: We don't set 'trust' to avoid automatic reconnection
# The device will be paired but won't automatically reconnect
child.sendline('quit')
child.close()

View file

@ -145,17 +145,21 @@ async def scan_ble_devices():
try:
print("Scanning for MeshCore BLE devices...", file=sys.stderr, flush=True)
def match_meshcore_device(device: BLEDevice, advertisement_data: AdvertisementData):
"""Filter to match MeshCore devices."""
if advertisement_data.local_name and advertisement_data.local_name.startswith("MeshCore"):
return True
# Also check for T1000 devices
if advertisement_data.local_name and "T1000" in advertisement_data.local_name:
return True
return False
# Scan for all devices first, then filter
devices = await BleakScanner.discover(timeout=10.0)
# Scan for devices
devices = await BleakScanner.discover(timeout=10.0, detection_callback=match_meshcore_device)
# Filter to only MeshCore devices
meshcore_devices = []
for device in devices:
if device.name:
# Check for MeshCore-* or Meshcore-* devices
if device.name.startswith("MeshCore-") or device.name.startswith("Meshcore-"):
meshcore_devices.append(device)
# Also check for T1000 devices
elif "T1000" in device.name:
meshcore_devices.append(device)
devices = meshcore_devices
if not devices:
print("No MeshCore BLE devices found", file=sys.stderr, flush=True)