mirror of https://github.com/m-labs/artiq.git
drop support for big-endian moninj
This commit is contained in:
parent
d644e982c8
commit
922d2b1619
|
@ -33,14 +33,6 @@ class CommMonInj:
|
|||
|
||||
try:
|
||||
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())
|
||||
except:
|
||||
self._writer.close()
|
||||
|
@ -62,19 +54,19 @@ class CommMonInj:
|
|||
del self._writer
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
async def _receive_cr(self):
|
||||
|
@ -85,12 +77,11 @@ class CommMonInj:
|
|||
return
|
||||
if ty == b"\x00":
|
||||
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)
|
||||
elif ty == b"\x01":
|
||||
payload = await self._reader.readexactly(6)
|
||||
channel, override, value = struct.unpack(
|
||||
self.endian + "lbb", payload)
|
||||
channel, override, value = struct.unpack("<lbb", payload)
|
||||
self.injection_status_cb(channel, override, value)
|
||||
else:
|
||||
raise ValueError("Unknown packet type", ty)
|
||||
|
|
|
@ -123,7 +123,6 @@ fn connection_worker(io: &Io, _aux_mutex: &Mutex, _routing_table: &drtio_routing
|
|||
let mut next_check = 0;
|
||||
|
||||
read_magic(&mut stream)?;
|
||||
stream.write_all("e".as_bytes())?;
|
||||
info!("new connection from {}", stream.remote_endpoint());
|
||||
|
||||
loop {
|
||||
|
|
|
@ -169,7 +169,6 @@ class ProxyServer(AsyncioServer):
|
|||
if line != b"ARTIQ moninj\n":
|
||||
logger.error("incorrect magic")
|
||||
return
|
||||
writer.write(b"e")
|
||||
await ProxyConnection(self.monitor_mux, reader, writer).handle()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue