Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fdfaa276f603
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: af55b2860158
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 5, 2019

  1. Copy the full SHA
    af55b28 View commit details
Showing with 7 additions and 2 deletions.
  1. +7 −2 software/glasgow/applet/interface/uart/__init__.py
9 changes: 7 additions & 2 deletions software/glasgow/applet/interface/uart/__init__.py
Original file line number Diff line number Diff line change
@@ -196,6 +196,9 @@ def add_interact_arguments(cls, parser):

p_tty = p_operation.add_parser(
"tty", help="connect UART to stdin/stdout")
p_tty.add_argument(
"--cr", action="store_true", default=False,
help="send carriage return as CR, not LF")
p_tty.add_argument(
"-s", "--stream", action="store_true", default=False,
help="continue reading from I/O port even after an end-of-file condition on stdin")
@@ -270,7 +273,7 @@ async def _forward(self, in_fileno, out_fileno, uart, quit_sequence=False, strea
if fut is not None and not fut.done():
fut.cancel()

async def _interact_tty(self, uart, stream):
async def _interact_tty(self, uart, stream, cr):
in_fileno = sys.stdin.fileno()
out_fileno = sys.stdout.fileno()

@@ -280,6 +283,8 @@ async def _interact_tty(self, uart, stream):
old_stdin_attrs = termios.tcgetattr(sys.stdin)
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc] = old_stdin_attrs
lflag &= ~(termios.ECHO | termios.ICANON | termios.ISIG)
if cr:
iflag &= ~termios.ICRNL
cc[termios.VMIN] = 1
new_stdin_attrs = [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]
termios.tcsetattr(in_fileno, termios.TCSADRAIN, new_stdin_attrs)
@@ -328,7 +333,7 @@ async def interact(self, device, args, uart):
asyncio.ensure_future(self._monitor_errors(device))

if args.operation == "tty":
await self._interact_tty(uart, args.stream)
await self._interact_tty(uart, args.stream, args.cr)
if args.operation == "pty":
await self._interact_pty(uart)
if args.operation == "socket":