Skip to content

Commit

Permalink
feat: give DBus some time to catch up to avoid spurious warnings (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Aug 20, 2022
1 parent ac71159 commit 63188f6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bluetooth_auto_recovery/recover.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
POWER_OFF_TIME = 2
POWER_ON_TIME = 3
MAX_RESET_TIME = 10
DBUS_REGISTER_TIME = 0.5


def rfkill_list_bluetooth(hci: int) -> tuple[bool | None, bool | None]:
Expand Down Expand Up @@ -159,6 +160,8 @@ async def _reset_bluetooth(hci: int) -> bool:
_LOGGER.debug(
"Power state of bluetooth adapter hci%i is ON after power cycle", hci
)
# Give Dbus some time to catch up
await asyncio.sleep(DBUS_REGISTER_TIME)
return True

if pstate_after is False:
Expand Down

0 comments on commit 63188f6

Please sign in to comment.