Skip to content

Commit

Permalink
refactor(ecu): remove unnecessary level parameter from leave_session()
Browse files Browse the repository at this point in the history
  • Loading branch information
fkglr committed Nov 28, 2023
1 parent 9d15735 commit 5a2bdb4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/gallia/commands/fuzz/uds/pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def main(self, args: Namespace) -> None:
logger.result(f"Flow control frames missing: {flow_control_miss}")

logger.info(f"Leaving session 0x{session:02x} via hook")
await self.ecu.leave_session(session)
await self.ecu.leave_session()

if args.observe_can_ids:
recv_task.cancel()
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def main(self, args: Namespace) -> None:

logger.result(f"Scan in session {g_repr(session)} is complete!")
logger.info(f"Leaving session {g_repr(session)} via hook")
await self.ecu.leave_session(session)
await self.ecu.leave_session()

async def perform_scan(self, args: Namespace, session: None | int = None) -> None:
positive_DIDs = 0
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def main(self, args: Namespace) -> None:
logger.result(f"Scanning in session: {g_repr(session)}")
await self.perform_scan(args, session)

await self.ecu.leave_session(session)
await self.ecu.leave_session()

async def perform_scan(self, args: Namespace, session: None | int = None) -> None:
l_ok: list[int] = []
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/sa_dump_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ async def main(self, args: Namespace) -> None:

await file.close()
self.log_size(seeds_file, time.time() - start_time)
await self.ecu.leave_session(session)
await self.ecu.leave_session()
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def main(self, args: Namespace) -> None:

found[session] = await self.perform_scan(args, session)

await self.ecu.leave_session(session)
await self.ecu.leave_session()

for key, value in found.items():
logger.result(f"findings in session 0x{key:02X}:")
Expand Down
8 changes: 2 additions & 6 deletions src/gallia/services/uds/ecu.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,13 @@ async def callback() -> None:
self.state.reset()
return True

async def leave_session(
self, level: int, config: UDSRequestConfig | None = None
) -> bool:
async def leave_session(self, config: UDSRequestConfig | None = None) -> bool:
"""leave_session() is a hook which can be called explicitly by a
scanner when a session is to be disabled. Use this hook if resetting
the ECU is required, e.g. when disabling the programming session.
Args:
uds: The UDSClient class where this hook is embedded. The caller typically
calls this function with `self` as the first argument.
session: The desired session identifier.
config: The configuration.
Returns:
True on success, False on error.
"""
Expand Down

0 comments on commit 5a2bdb4

Please sign in to comment.