通过 bash 脚本发送 picocom 命令
Send picocom commands via a bash script
我想通过脚本更新我的设备固件,使用 picocom 命令发送文件(ymodem 协议)。当我使用相关参数(如下所示)手动启动 picocom 时,它起作用了。例如。我可以通过终端发送命令来重启设备。有效。
picocom /dev/ttyACM0 -b 115200
但是,当我在 bash 脚本中放置相同的命令时,在 运行 脚本中出现错误 'no such file or directoryACM0'。用户已添加到 dialout 和 tty 组。所以我对错误感到困惑。任何的意见都将会有帮助。我也试过minicom,但是运气不太好。
port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
: No such file or directoryACM0
以下是我要发送的命令的几个示例:
command: #000C0074B0FFFF28!
command: 1
您可以尝试通过 picocom
的标准输入发送命令,但如果需要,可能必须明确翻译 Ctrl 键序列。例如 Ctrlq 应该被翻译成 0x11
(其他序列见这个 table):
更新:
给定命令和 here-document 的示例是:
picocom /dev/ttyACM0 -b 115200 <<'EOF'
#000C0074B0FFFF28!
1
EOF
我想通过脚本更新我的设备固件,使用 picocom 命令发送文件(ymodem 协议)。当我使用相关参数(如下所示)手动启动 picocom 时,它起作用了。例如。我可以通过终端发送命令来重启设备。有效。
picocom /dev/ttyACM0 -b 115200
但是,当我在 bash 脚本中放置相同的命令时,在 运行 脚本中出现错误 'no such file or directoryACM0'。用户已添加到 dialout 和 tty 组。所以我对错误感到困惑。任何的意见都将会有帮助。我也试过minicom,但是运气不太好。
port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
: No such file or directoryACM0
以下是我要发送的命令的几个示例:
command: #000C0074B0FFFF28!
command: 1
您可以尝试通过 picocom
的标准输入发送命令,但如果需要,可能必须明确翻译 Ctrl 键序列。例如 Ctrlq 应该被翻译成 0x11
(其他序列见这个 table):
更新:
给定命令和 here-document 的示例是:
picocom /dev/ttyACM0 -b 115200 <<'EOF'
#000C0074B0FFFF28!
1
EOF