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