From 6e1124c187d6591dbc6e08c5ac199456164a0a1d Mon Sep 17 00:00:00 2001 From: Teo Mahnic Date: Mon, 6 Jul 2026 11:47:16 +0200 Subject: [PATCH] SDSIO-VSI: shutdown SDSIO manager on exit --- template/Board/Corstone-300/vsi/python/arm_vsi3.py | 10 ++++++++++ template/Board/Corstone-320/vsi/python/arm_vsi3.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/template/Board/Corstone-300/vsi/python/arm_vsi3.py b/template/Board/Corstone-300/vsi/python/arm_vsi3.py index 22b4d0a..adc4083 100644 --- a/template/Board/Corstone-300/vsi/python/arm_vsi3.py +++ b/template/Board/Corstone-300/vsi/python/arm_vsi3.py @@ -25,6 +25,7 @@ #More details. import os +import atexit import logging import logging.handlers from os import path @@ -222,6 +223,15 @@ def _build_sdsio_request(command: int, sid: int = 0, argument: int = 0, data: by control_input_factory=False, ) +# Shutdown SDSIO manager on exit +def shutdown(): + try: + Stream.shutdown() + except Exception: + logger.error("Failed to shutdown SDSIO manager.") + +# Register the shutdown function to be called on exit +atexit.register(shutdown) ## Process command # @param command requested SDSIO command diff --git a/template/Board/Corstone-320/vsi/python/arm_vsi3.py b/template/Board/Corstone-320/vsi/python/arm_vsi3.py index 22b4d0a..adc4083 100644 --- a/template/Board/Corstone-320/vsi/python/arm_vsi3.py +++ b/template/Board/Corstone-320/vsi/python/arm_vsi3.py @@ -25,6 +25,7 @@ #More details. import os +import atexit import logging import logging.handlers from os import path @@ -222,6 +223,15 @@ def _build_sdsio_request(command: int, sid: int = 0, argument: int = 0, data: by control_input_factory=False, ) +# Shutdown SDSIO manager on exit +def shutdown(): + try: + Stream.shutdown() + except Exception: + logger.error("Failed to shutdown SDSIO manager.") + +# Register the shutdown function to be called on exit +atexit.register(shutdown) ## Process command # @param command requested SDSIO command