diff --git a/nrf802154_sniffer/nrf802154_sniffer.py b/nrf802154_sniffer/nrf802154_sniffer.py index a0d9e98..1ba9689 100755 --- a/nrf802154_sniffer/nrf802154_sniffer.py +++ b/nrf802154_sniffer/nrf802154_sniffer.py @@ -164,7 +164,7 @@ def stop_sig_handler(self, *args, **kwargs): try: thread.join(timeout=10) if thread.is_alive() is True: - self.logger.error("Failed to stop a thread") + self.logger.error("Failed to stop thread {}".format(thread.name)) alive_threads.append(thread) except RuntimeError: # TODO: This may be called from one of threads from thread list - architecture problem @@ -174,6 +174,11 @@ def stop_sig_handler(self, *args, **kwargs): else: self.logger.warning("Asked to stop {} while it was already stopped".format(self)) + if self.serial is not None: + if self.serial.is_open is True: + self.serial.close() + self.serial = None + @staticmethod def get_hex_path(): """Helper method to get hex file path with nrf802154_sniffer firmware.