forked from M-Labs/artiq
1
0
Fork 0

drop support for big-endian moninj

This commit is contained in:
Sebastien Bourdeauducq 2022-03-19 22:58:31 +08:00
parent d644e982c8
commit 922d2b1619
3 changed files with 6 additions and 17 deletions

View File

@ -33,14 +33,6 @@ class CommMonInj:
try: try:
self._writer.write(b"ARTIQ moninj\n") self._writer.write(b"ARTIQ moninj\n")
# get device endian
endian = await self._reader.read(1)
if endian == b"e":
self.endian = "<"
elif endian == b"E":
self.endian = ">"
else:
raise IOError("Incorrect reply from device: expected e/E.")
self._receive_task = asyncio.ensure_future(self._receive_cr()) self._receive_task = asyncio.ensure_future(self._receive_cr())
except: except:
self._writer.close() self._writer.close()
@ -62,19 +54,19 @@ class CommMonInj:
del self._writer del self._writer
def monitor_probe(self, enable, channel, probe): def monitor_probe(self, enable, channel, probe):
packet = struct.pack(self.endian + "bblb", 0, enable, channel, probe) packet = struct.pack("<bblb", 0, enable, channel, probe)
self._writer.write(packet) self._writer.write(packet)
def monitor_injection(self, enable, channel, overrd): def monitor_injection(self, enable, channel, overrd):
packet = struct.pack(self.endian + "bblb", 3, enable, channel, overrd) packet = struct.pack("<bblb", 3, enable, channel, overrd)
self._writer.write(packet) self._writer.write(packet)
def inject(self, channel, override, value): def inject(self, channel, override, value):
packet = struct.pack(self.endian + "blbb", 1, channel, override, value) packet = struct.pack("<blbb", 1, channel, override, value)
self._writer.write(packet) self._writer.write(packet)
def get_injection_status(self, channel, override): def get_injection_status(self, channel, override):
packet = struct.pack(self.endian + "blb", 2, channel, override) packet = struct.pack("<blb", 2, channel, override)
self._writer.write(packet) self._writer.write(packet)
async def _receive_cr(self): async def _receive_cr(self):
@ -85,12 +77,11 @@ class CommMonInj:
return return
if ty == b"\x00": if ty == b"\x00":
payload = await self._reader.readexactly(13) payload = await self._reader.readexactly(13)
channel, probe, value = struct.unpack(self.endian + "lbq", payload) channel, probe, value = struct.unpack("<lbq", payload)
self.monitor_cb(channel, probe, value) self.monitor_cb(channel, probe, value)
elif ty == b"\x01": elif ty == b"\x01":
payload = await self._reader.readexactly(6) payload = await self._reader.readexactly(6)
channel, override, value = struct.unpack( channel, override, value = struct.unpack("<lbb", payload)
self.endian + "lbb", payload)
self.injection_status_cb(channel, override, value) self.injection_status_cb(channel, override, value)
else: else:
raise ValueError("Unknown packet type", ty) raise ValueError("Unknown packet type", ty)

View File

@ -123,7 +123,6 @@ fn connection_worker(io: &Io, _aux_mutex: &Mutex, _routing_table: &drtio_routing
let mut next_check = 0; let mut next_check = 0;
read_magic(&mut stream)?; read_magic(&mut stream)?;
stream.write_all("e".as_bytes())?;
info!("new connection from {}", stream.remote_endpoint()); info!("new connection from {}", stream.remote_endpoint());
loop { loop {

View File

@ -169,7 +169,6 @@ class ProxyServer(AsyncioServer):
if line != b"ARTIQ moninj\n": if line != b"ARTIQ moninj\n":
logger.error("incorrect magic") logger.error("incorrect magic")
return return
writer.write(b"e")
await ProxyConnection(self.monitor_mux, reader, writer).handle() await ProxyConnection(self.monitor_mux, reader, writer).handle()