基本上我已经厌倦了输入大量文字。显然想将其输入文件中,将其推送到UART U-Boot,然后修改文件,再试一次。
但 Shift+Ctrl+C 都无法screen ttyUSB0 115200
正常工作,或者cat file.cmd > ttyUSB0
.
有人有复制到 UART 的奇特方法吗?我不可能是唯一一个尝试做这样的事情的人。
答案1
好吧,必须制作一个小脚本来做到这一点,呃,足够好了:
cat > slowpipe << 'EOF'
#!/usr/bin/env bash
set -eu
data=$(< /dev/stdin)
hz=$(bc -l <<< "1.0 / $1")
while [ -n "$data" ]; do
printf '%s' "${data:0:1}"
data=${data:1}
sleep $hz
done
# XXX It seems to be imposible to save leading newlines in variables,
# you cant have var=$'\n'$'\n' no mater what you do, only one new line can will
# be saved, IFS won't help, or anything. one way is to use `read`, without
# saving all stdin to variable.
echo
EOF
chmod 755 slowpipe
./slowpipe 42 < rpi.cmd >> /dev/ttyUSB0