通过串行端口传输文件

发布于 2025-01-30 15:44:15 字数 743 浏览 2 评论 0原文

我正在尝试通过串行端口发送文件。我尝试以bash脚本发送picocom命令。但是,该设备写下了选项菜单。当它到达文件传输步骤时 - 它写出“ C”,直到发送文件为止,然后进行握手并进行转移。使用脚本,我无法发送击键“ CA”和“ CS”来获取“ ***文件:” Picocom的提示。我可以手动做。我什至尝试了Bash和Python和Pyautogui的组合,以击中击键,Bash Echo Command发送了Kex版本的Kex版本。我什至尝试通过脚本和STTY发送“ SZ”命令。所有这些尝试都没有成功。

因此,我切换到Python,然后尝试了 xmodem库pypi.org/project/xmodem/“ rel =” python中的nofollow noreferrer“>”。我应该使用ymodem。我认为库中的“ Ymodem批处理传输会话”将完成这项工作。调制解调器命令命令始终错误,而未发送文件。

Read Byte: b'C'
Put Byte: 133
Read Byte: b'C'
send error: expected ACK; got b'C' for block 1
Put Byte: 133
Read Byte: b'C'
send error: expected ACK; got b'C' for block 1

我该如何解决?

I am trying to send a file via serial port. I tried sending picocom commands in a bash script. However the device writes out a menu of options. When it gets to the file transfer step - it writes out 'C' until a file is sent, after which it does the handshake and proceeds with the transfer. With the script I am not able to send the keystrokes 'C-a' and 'C-s' to get the '*** file:' prompt of picocom. I can do it manually. I even tried a combination of bash and python and pyautogui for the keystrokes, bash echo command to send the hex version of the keystrokes. I even tried sending 'sz' commands through the script and stty. All of these attempts were unsuccessful.

So I switched to python, and tried the xmodem library in python. I am supposed to use ymodem. I thought the 'YMODEM batch transmission session' in the library would do the job. The modem.send command always errors out with the file not being sent.

Read Byte: b'C'
Put Byte: 133
Read Byte: b'C'
send error: expected ACK; got b'C' for block 1
Put Byte: 133
Read Byte: b'C'
send error: expected ACK; got b'C' for block 1

How can i get around this?

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

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

发布评论

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

评论(1

音栖息无 2025-02-06 15:44:15

最终最终使用了Python和Bash -Python的组合,用于串行通信和解析二进制文件的文件名,以及Bash Sttysb命令,用于传输二进制文件。

Finally ended up using a combination of python and bash - python for serial communication and for parsing the file names of the binaries, and, bash stty and sb commands for transferring the binaries.

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