通过bash脚本发送picocom命令

发布于 2025-01-28 14:42:23 字数 888 浏览 3 评论 0原文

我想使用picocom命令通过脚本更新设备的固件来发送文件(ymodem协议)。当我手动开始使用相关参数(如下)时,它可以正常工作。例如,我可以通过终端发送命令以重新启动设备。有用。

picocom /dev/ttyACM0 -b 115200

但是,当我运行脚本时,当我将相同的命令放在bash脚本中时,我会出现错误“否此类文件或DirectoryAcm0”。用户已添加到拨号和TTY组中。所以我对这个错误感到困惑。任何建议都会有所帮助。我也尝试了微型糖果,但运气不多。

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 

I want to update the firmware of my device via a script using picocom commands to send the file (ymodem protocol). When I start picocom manually, with the relevant parameters (as below), it works. E.g. I can send the command via the terminal to restart the device. It works.

picocom /dev/ttyACM0 -b 115200

However, when I put the same command in a bash script I get the error 'no such file or directoryACM0' when I run the script. The user has been added to the dialout and tty groups. So I am puzzled by the error. any suggestions would be helpful. I also tried minicom, but did not have much luck.

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

Here are a couple examples of the commands that I want to send:

command: #000C0074B0FFFF28!  
command: 1 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柳若烟 2025-02-04 14:42:23

您可以尝试通过picocom的stdin发送命令,但如果需要,可能必须明确地将 ctrl - 键序列明确翻译。例如 ctrl q 应翻译成0x11(请参阅此对于其他序列):

更新:

带有给定命令的示例和此处的文档将是:

picocom /dev/ttyACM0 -b 115200 <<'EOF'
#000C0074B0FFFF28!
1
EOF

You can try sending the commands through picocom's stdin, but might have to translate explicitly the Ctrl‑key sequences if you need them. For example Ctrlq should be translated to 0x11 (see this table for the other sequences):

Update:

An example with the given commands and a here-document would be:

picocom /dev/ttyACM0 -b 115200 <<'EOF'
#000C0074B0FFFF28!
1
EOF
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文