Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close the serial port when capture is stopped #31

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion nrf802154_sniffer/nrf802154_sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down