less aggressive bt resets
This commit is contained in:
1 parent
eba1c3d1e2
commit
53d0d4564a
1 file changed
+6
-6
+6
-6
@@ -289,8 +289,7 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
||||
mac_history.append(passed_list)
|
||||
if len(mac_history) == reset_retries and all(lst == mac_history[0] for lst in mac_history):
|
||||
log.warning(f"Last {reset_retries} tests have been identical, resetting adapter")
|
||||
reset_adapter()
|
||||
rkill_bt()
|
||||
rfkill_bt()
|
||||
mac_history = []
|
||||
prev_list_snapshot = passed_list
|
||||
|
||||
@@ -322,7 +321,7 @@ def test_driver(test_count = 0, bt_usb_id = None):
|
||||
# If not, then re-scan the failed sensors
|
||||
elif test_loop_count > len(mac_list) * 25:
|
||||
log.error(f"Test has reached {len(mac_list) * 25} loops, failing test, rfkill bluetooth, will begin next test run.")
|
||||
rkill_bt()
|
||||
rfkill_bt()
|
||||
test_complete = True
|
||||
result = {
|
||||
"found_macs": found_macs,
|
||||
@@ -368,13 +367,13 @@ def reset_adapter():
|
||||
if len(current_usb_id) > 0:
|
||||
log.warning(f"Doing big reset - USB ID {current_usb_id}")
|
||||
log.info(subprocess.run(["usbreset", current_usb_id], capture_output=True, text=True, check=True).stdout.strip())
|
||||
time.sleep(2)
|
||||
time.sleep(5)
|
||||
else:
|
||||
log.warning("Hmm, this shouldn't happen, the current_usb_id is blank 0_o")
|
||||
log.info("Reset complete. ")
|
||||
|
||||
# this subroutine will rfkill the bluetooth
|
||||
def rkill_bt():
|
||||
def rfkill_bt():
|
||||
log.info(subprocess.run(["rfkill", "block", "bluetooth"], capture_output=True, text=True, check=True).stdout.strip())
|
||||
time.sleep(5)
|
||||
log.info(subprocess.run(["rfkill", "unblock", "bluetooth"], capture_output=True, text=True, check=True).stdout.strip())
|
||||
@@ -495,7 +494,8 @@ if __name__ == "__main__":
|
||||
log.info(f"BLE USB ID Detected: {current_usb_id} - Resetting")
|
||||
|
||||
# one last adapter reset before the test
|
||||
reset_adapter()
|
||||
#reset_adapter()
|
||||
restart_bt_service()
|
||||
|
||||
####################################################
|
||||
# Beginning test
|
||||
|
||||
Reference in new issue
Block a user