lp-dp 2023-06-12T05:58:26 for EON/C2

version: lp-dp v0.9.3 for EON/C2
date: 2023-06-12T05:58:26
commit: a6e632fddf5e5e22867c0fd549b4e701cbc35d63
This commit is contained in:
Vehicle Researcher
2023-06-12 05:56:32 +00:00
parent 3ed6e4b836
commit d3cc1e84a3
237 changed files with 31427 additions and 3781 deletions

View File

@@ -529,13 +529,15 @@ class Panda:
return True
@staticmethod
def wait_for_dfu(dfu_serial: str, timeout: Optional[int] = None) -> bool:
def wait_for_dfu(dfu_serial: Optional[str], timeout: Optional[int] = None) -> bool:
t_start = time.monotonic()
while dfu_serial not in PandaDFU.list():
dfu_list = PandaDFU.list()
while (dfu_serial is None and len(dfu_list) == 0) or (dfu_serial is not None and dfu_serial not in dfu_list):
logging.debug("waiting for DFU...")
time.sleep(0.1)
if timeout is not None and (time.monotonic() - t_start) > timeout:
return False
dfu_list = PandaDFU.list()
return True
def up_to_date(self) -> bool:
@@ -626,12 +628,6 @@ class Panda:
# ******************* control *******************
def enter_bootloader(self):
try:
self._handle.controlWrite(Panda.REQUEST_OUT, 0xd1, 0, 0, b'')
except Exception:
logging.exception("exception while entering bootloader")
def get_version(self):
return self._handle.controlRead(Panda.REQUEST_IN, 0xd6, 0, 0, 0x40).decode('utf8')

View File

@@ -77,7 +77,7 @@ class STBootloaderUSBHandle(BaseSTBootloaderHandle):
self._status()
# Program
bs = self._mcu_type.config.block_size
bs = min(len(dat), self._mcu_type.config.block_size)
dat += b"\xFF" * ((bs - len(dat)) % bs)
for i in range(0, len(dat) // bs):
ldat = dat[i * bs:(i + 1) * bs]