Skip to content

Commit

Permalink
add sniffer option to be able to explicetly set the desired sniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Dec 4, 2024
1 parent 6193ae7 commit 97d58f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SimCommand:
args: Optional[list] = None
need_upload_firmware: bool = False
need_load_parameters: bool = False
sniffer: Optional[str] = None

def check(self, command: str) -> bool:
if isinstance(command, str):
Expand Down
8 changes: 7 additions & 1 deletion scripts/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ def _execute_hitl_container(self, command) -> None:
command.need_upload_firmware,
command.need_load_parameters)

sniffer_path = command.sniffer if command.sniffer else self._model.transport

process = DockerWrapper.run_sim_container(mode=command.mode,
image_name=self._model.full_image_name,
argument=command.sim_config,
sniffer_path=self._model.transport)
sniffer_path=sniffer_path)
self._model.add_process(process)

def _execute_sitl_container(self, command) -> None:
Expand Down Expand Up @@ -207,6 +209,9 @@ def main():
force_help = "both upload and then configure"
parser.add_argument("--force", help=force_help, default=False, action='store_true')

sniffer_help = "explicitly specify what sniffer to use"
parser.add_argument("--sniffer", type=str, required=False, help=sniffer_help, default=None)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand All @@ -221,6 +226,7 @@ def main():

command.need_upload_firmware = args.force or args.upload
command.need_load_parameters = args.force or args.configure
command.sniffer = args.sniffer

model = SimModel()
view = SimView(model, command.name)
Expand Down

0 comments on commit 97d58f3

Please sign in to comment.