1 parent 0298e2e commit 025b192Copy full SHA for 025b192
1 file changed
unit-tests/live/config/test-device-hub.py
@@ -28,21 +28,21 @@
28
# -------- Disconnect detection via hardware reset --------
29
test.start("device_hub: detect disconnect after hardware_reset")
30
caught_once = False
31
+attempt = 1
32
-for attempt in range(1, MAX_TRIES + 1):
33
+while not caught_once and attempt <= MAX_TRIES:
34
try:
35
log.i(f"Attempt {attempt}/{MAX_TRIES}: issuing hardware_reset()")
36
dev.hardware_reset()
37
+ attempt += 1
38
39
# Wait until hub reports this handle as disconnected
40
t = time.time()
41
while time.time() - t < DISCONNECT_TIMEOUT_SEC:
42
if not hub.is_connected(dev):
43
caught_once = True
44
break
-
- if caught_once:
45
- break
+ time.sleep(0.1)
46
47
except:
48
test.unexpected_exception()
0 commit comments