Commit f92755b8 authored by cermak's avatar cermak
Browse files

better handling of readline

Change-Id: Iad3e9e5183bb810c162ba7ba9b87200efd40af7f
parent dc491602
......@@ -40,14 +40,16 @@ class StringIO(SerialStringIO):
#ask for value
self.WriteLine(msg)
for i in range(100):
if self.read_availableLines():
try:
firstline = self.ReadLine()
self.log.debug("I have line!")
break
self.log.debug(f"waiting for response #{i}")
sleep(0.1)
except CommunicationFailure:
self.log.debug(f"waiting for response #{i}")
sleep(0.1)
else:
raise CommunicationFailure(f"no response in 10s")
firstline = self.ReadLine()
if firstline != msg:
raise CommunicationFailure(f"command not repeated {firstline}!={msg}")
return self.ReadLine()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment