Serial comm with Tango Serial DS ignore timeout
It might a bug in Serial
rather than Bliss.
from bliss.comm.util import get_comm, SERIAL
conf = {"serial": {"url": "tango://xxx/dev/ttyS0"}}
opt = {"parity": "N", "eol":b"\r\n"}
kom = get_comm(conf, ctype=SERIAL, **opt)
kom.write_read(b"*IDN?\n", timeout=10) # Returns immediatly with ConnectionTimeout exception
For the records, before switching to ser2net (works fine), I had this workaround:
def my_write_read(self, msg: bytes, size=1, timeout=None):
with self.__serial._lock:
try:
self.__serial._write(msg)
gevent.sleep(timeout)
ans = self.__serial._read(size)
except BaseException:
self.__serial.flush()
raise
return ans
Edited by Cyril Guilloud