我需要发送一个.bin文件通过XModem传输到调制解调器固件升级。
如果调制解调器连接到本地计算机,则命令如下:
sz -X -k -b -vvv - file_to_transfer.BIN > /dev/ttyUSB0 < /dev/ttyUSB0 我还在模块端发出了接收文件所需的命令。
问题是,我需要在一个远程主机上这样做,它里面有这些调制解调器。我无法将文件传输到设备,因为主机没有足够的内存来存储文件。
最后的想法是将文件输送到sz命令中。我在本地使用以下命令进行了尝试:
cat file_to_transfer.BIN | sz -X -k -b -vvv - > /dev/ttyUSB0 < /dev/ttyUSB0此命令提供以下错误消息:
Sending s2382.lsz, 0 blocks: Give your local XMODEM receive command now.
Xmodem sectors/kbytes sent: 0/ 0kRetry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Timeout on sector ACK
Retry 0: Retry Count Exceeded请有人解释一下为什么这不起作用,或者是否有更好的办法来解决这个问题。
发布于 2016-10-05 18:02:38
我想是有点晚了,但我只是遇到了一个类似的问题。
使用fifo (命名管道)。请参阅https://linux.die.net/man/3/mkfifo
# Create a temporary fifo
mkfifo /tmp/sz_fifo
# Write the file to the fifo and place in the background
# (Replace "cat" with some other command to stream over the network)
cat file_to_transfer.BIN > /tmp/sz_fifo &
# sz will read the file from the fifo
sz -X -k -b -vvv - /tmp/sz_fifo > /dev/ttyUSB0 < /dev/ttyUSB0
# Clean up
rm /tmp/sz_fifohttps://unix.stackexchange.com/questions/219004
复制相似问题