Merge pull request from dadav/fix/bt-dbus-bug

Fix str comparison and add sleep
This commit is contained in:
evilsocket 2019-10-18 19:35:27 +02:00 committed by GitHub
commit cff487008c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -132,7 +132,7 @@ class BTNap:
device = ifaces.get(BTNap.IFACE_DEV) device = ifaces.get(BTNap.IFACE_DEV)
if device is None: if device is None:
continue continue
if device['Address'] == device_address and path.startswith(path_prefix): if str(device['Address']) == device_address and path.startswith(path_prefix):
obj = bus.get_object(BTNap.IFACE_BASE, path) obj = bus.get_object(BTNap.IFACE_BASE, path)
return dbus.Interface(obj, BTNap.IFACE_DEV) return dbus.Interface(obj, BTNap.IFACE_DEV)
raise BTError('Bluetooth device not found') raise BTError('Bluetooth device not found')
@ -245,6 +245,7 @@ class BTNap:
try: try:
dev_remote.Pair() dev_remote.Pair()
logging.info('BT-TETHER: Successful paired with device ;)') logging.info('BT-TETHER: Successful paired with device ;)')
time.sleep(10) # wait for bnep0
except Exception: except Exception:
# can fail because of AlreadyExists etc. # can fail because of AlreadyExists etc.
pass pass