FDD-book/examples/part-06/ch26-usb-serial/lab08-tty-troubleshoot/diagnose.sh
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

24 lines
475 B
Bash
Executable file

#!/bin/sh
#
# diagnose.sh - Compare termios settings on both ends of a TTY pair.
set -eu
A=${A:-/dev/nmdm0.A}
B=${B:-/dev/nmdm0.B}
if [ ! -c "${A}" ] || [ ! -c "${B}" ]; then
echo "One of ${A}, ${B} is missing. Load nmdm and open the pair."
exit 2
fi
echo "=== A: ${A} ==="
stty -a -f "${A}"
echo
echo "=== B: ${B} ==="
stty -a -f "${B}"
echo
echo "=== Diff ==="
diff -u \
<(stty -a -f "${A}" | tr ';' '\n' | sort) \
<(stty -a -f "${B}" | tr ';' '\n' | sort) || true