Skip to content
Snippets Groups Projects
Commit 0509ca7b authored by Robin Mueller's avatar Robin Mueller
Browse files

exception handling for non-existing qemu files

parent 6788197c
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,16 @@ import struct ...@@ -22,12 +22,16 @@ import struct
import json import json
import re import re
import errno import errno
import sys
import time import time
from threading import Thread from threading import Thread
from typing import Tuple from typing import Tuple
from logging import getLogger
from comIF.obsw_com_interface import CommunicationInterface, PusTcInfoT, PusTmListT from comIF.obsw_com_interface import CommunicationInterface, PusTcInfoT, PusTmListT
from tm.obsw_pus_tm_factory import PusTelemetryFactory from tm.obsw_pus_tm_factory import PusTelemetryFactory
LOGGER = getLogger()
# Paths to Unix Domain Sockets used by the emulator # Paths to Unix Domain Sockets used by the emulator
QEMU_ADDR_QMP = "/tmp/qemu" QEMU_ADDR_QMP = "/tmp/qemu"
QEMU_ADDR_AT91_USART0 = "/tmp/qemu_at91_usart0" QEMU_ADDR_AT91_USART0 = "/tmp/qemu_at91_usart0"
...@@ -66,10 +70,13 @@ class QEMUComIF(CommunicationInterface): ...@@ -66,10 +70,13 @@ class QEMUComIF(CommunicationInterface):
self.thread = Thread(target=start_background_loop, self.thread = Thread(target=start_background_loop,
args=(self.loop,), daemon=True) args=(self.loop,), daemon=True)
self.thread.start() self.thread.start()
try:
self.usart = asyncio.run_coroutine_threadsafe( self.usart = asyncio.run_coroutine_threadsafe(
Usart.create_async(QEMU_ADDR_AT91_USART0), self.loop).result() Usart.create_async(QEMU_ADDR_AT91_USART0), self.loop).result()
asyncio.run_coroutine_threadsafe(self.usart.open(), self.loop).result() asyncio.run_coroutine_threadsafe(self.usart.open(), self.loop).result()
except NotImplementedError:
LOGGER.exception("QEMU Initialization error, file does not exist!")
sys.exit()
def close(self): def close(self):
self.usart.close() self.usart.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment