This commit is contained in:
xenia 2021-05-12 16:47:33 -04:00
parent 655e6a9c8a
commit 18e161e7d8
1 changed files with 2 additions and 12 deletions

View File

@ -158,23 +158,13 @@ async def megacom(tty: str, baud: int, mode: str) -> None:
async def connect_pipe(pin: asyncio.StreamReader, pout: asyncio.StreamWriter,
ctrl: bool = False) -> None:
esc: bool = False
while not pin.at_eof():
c: bytes = await pin.read(1)
if len(c) == 0:
continue
if esc:
esc = False
if c == b"\x01":
pout.write(b"\x01")
await pout.drain()
elif c == b"q":
keycodes.exit_flag.set()
break
if c == b"\x01" and ctrl:
esc = True
c = keycodes.process(c)
if len(c) == 0:
continue
pout.write(c)