基本上我已經厭倦了輸入大量文字。顯然想將其輸入檔案中,將其推送到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