diff --git a/src/gallia/commands/scan/uds/sessions.py b/src/gallia/commands/scan/uds/sessions.py index e461559fd..0bd0f5ef5 100644 --- a/src/gallia/commands/scan/uds/sessions.py +++ b/src/gallia/commands/scan/uds/sessions.py @@ -55,11 +55,8 @@ def configure_parser(self) -> None: ) self.parser.add_argument( "--reset", - nargs="?", - default=None, - const=0x01, - type=lambda x: int(x, 0), - help="Reset the ECU after each iteration with the optionally given reset level", + action="store_true", + help="Reset and if necessary power cycle the ECU after each iteration", ) self.parser.add_argument( "--fast", @@ -158,22 +155,15 @@ async def main(self, args: Namespace) -> None: if args.reset: try: logger.info("Resetting the ECU") - resp: UDSResponse = await self.ecu.ecu_reset(args.reset) + success = await self.ecu.leave_session(session) - if isinstance(resp, NegativeResponse): + if not success: logger.warning( - f"Could not reset ECU with {EcuResetSubFuncs(args.reset).name if args.reset in iter(EcuResetSubFuncs) else args.reset}: {resp}" - f"; continuing without reset" + f"Could not reset ECU; continuing without reset" ) else: logger.info("Waiting for the ECU to recover…") await self.ecu.wait_for_ecu(timeout=args.timeout) - except (asyncio.TimeoutError, ConnectionError): - logger.warning( - "Lost connection to the ECU after performing a reset. " - "Attempting to reconnect…" - ) - await self.ecu.reconnect() if not (await self.ecu.leave_session(session)): logger.error("Could not change to default session")