diff --git a/python/__init__.py b/python/__init__.py index 1f95008f712..6c714ca3b59 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -7,7 +7,6 @@ import hashlib import binascii import datetime -import warnings import logging from functools import wraps from typing import Optional @@ -427,7 +426,7 @@ def usb_list(cls): if len(serial) == 24: ret.append(serial) else: - warnings.warn(f"found device with panda descriptors but invalid serial: {serial}", RuntimeWarning) + logging.warning(f"found device with panda descriptors but invalid serial: {serial}", RuntimeWarning) except Exception: continue except Exception: @@ -464,23 +463,21 @@ def connected(self) -> bool: def reconnect(self): if self._handle_open: self.close() - time.sleep(1.0) success = False # wait up to 15 seconds - for i in range(0, 15): + for _ in range(0, 15*10): try: self.connect() success = True break except Exception: - logging.debug("reconnecting is taking %d seconds...", i + 1) try: dfu = PandaDFU(self.get_dfu_serial()) dfu.recover() except Exception: pass - time.sleep(1.0) + time.sleep(0.1) if not success: raise Exception("reconnect failed")