Skip to content

Commit

Permalink
Handle more bluetoothctl use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Aug 15, 2023
1 parent 5baddd0 commit 2b4de8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,11 @@ async def _async_def_pair() -> None:
else:
# We're not paired so do it now
bluetoothctl.sendline(f"pair {handle.address}")
bluetoothctl.expect("Accept pairing")
bluetoothctl.sendline("yes")
bluetoothctl.expect("Pairing successful")
if (match := bluetoothctl.expect(["Accept pairing", "Pairing successful"])) == 0:
bluetoothctl.sendline("yes")
bluetoothctl.expect("Pairing successful")
elif match == 1: # We received pairing successful so nothing else to do
pass

elif OS == "Darwin":
# No pairing on Mac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
"open_gopro.api.http_commands": logging.DEBUG,
"open_gopro.api.ble_commands": logging.DEBUG,
"open_gopro.communication_client": logging.DEBUG,
"open_gopro.ble.adapters.bleak_wrapper": logging.INFO,
"open_gopro.ble.adapters.bleak_wrapper": logging.INFO, # DEBUG for pexpect communication
"open_gopro.ble.client": logging.DEBUG,
"open_gopro.wifi.adapters.wireless": logging.DEBUG,
"open_gopro.responses": logging.DEBUG,
Expand Down

0 comments on commit 2b4de8e

Please sign in to comment.