1

I'm using Putty or Picocom to talk directly to a Mobile Modem using AT commands, while doing some experiments that require up/downloading some files on the mobile module's EFS partition. The protocol used to do this is Xmodem and it seem that most terminal utilities no longer include/support this. Picocom does as a 3rd party dependence:

Picocom can send and receive files over the serial port 
using external programs that implement the respective protocols. 
In Linux typical programs for this purpose are:

• rx(1) - receive using the X-MODEM protocol        *
• rb(1) - receive using the Y-MODEM protocol
• rz(1) - receive using the Z-MODEM protocol
• sx(1) - send using the X-MODEM protocol           *
• sb(1) - send using the Y-MODEM protocol
• sz(1) - send using the Z-MODEM protocol

However, none of these are available for Win/Cygwin and I'm not able to find the sources to compile these. (Where are these hosted these days?)

Q: What would be the easiest way to receive Xmodem data using command line?
(What other simple alternatives are there?)

I have already looked at the following Unix SE questions:

not2qubit
  • 1,666
  • What are the OSs of the local and remote systems? What exactly is the problem? Do you need the corresponding Xmodem program for the local or remote system? Do you want to automate the whole process of connecting to the remote system and sending and/or receiving files? – Bodo Jul 12 '19 at 09:30
  • The remote is an embedded uC. The local is Win/Cygwin. From one of the links, I managed to compile and run lrzsz through picocom, but it is waiting until timeout. Although file is received, the sources no longer match the man pages and the command options are obscure at best. – not2qubit Jul 12 '19 at 12:42
  • Please [edit] your question to add information instead of answering in comments. Without knowing more details it is difficult to know why lrzsz is waiting until timeout. Please write the exact commands you enter and/or describe in detail what you do in your terminal program. – Bodo Jul 12 '19 at 12:55

2 Answers2

3

The rx/rb/rz/sx/sb/sz tools are part of the lrzsz package, and packages.debian.org's package metadata for the source of that package identifies the upstream source location as:

https://ohse.de/uwe/software/lrzsz.html

Note that all these programs were originally designed to be used when you had a terminal-based modem connection to a Unix system (i.e. a direct connection from your computer's terminal emulator through the modem line to a Unix serial port login, no network protocols like TCP/IP involved at all).

They will expect the file transfer protocol to happen on their standard input/output: picocom and similar serial-port-oriented terminal emulators will automatically handle the necessary redirections, but if you are planning to use them "raw" on a command line, remember that you'll need to redirect their input and output to the appropriate serial port device, or else they'll try to talk their file transfer protocol with you instead of the serial-connected device.

telcoM
  • 96,466
2

first, you need to estabilish a connection between host and the target.

for this example I use 2 pl2303 (connect both rx to tx and ground to ground) to connect 2 computers (host, target), this create a /dev/ttyUSB0 on both sides. Having busybox on target is possible to estabilish a connection between both.

on target you need a tty connection, you can have this on initrc or if you have a console, you can use getty directly to open an connection like this:
# sh -c 'getty -Lin -l /bin/sh 115200 /dev/ttyUSB0' &

on host you need putty to connect to target, like this:
$ putty -serial -sercfg 115200,8,n,1 /dev/ttyUSB0

to start receiving a file on target you run rx like this on putty connection:
# rx file.bz2

to start sending file on host you run sx like this:
$ sx file.bz2 < /dev/ttyUSB0 > /dev/ttyUSB0

you will see the blocks transfering, take a coffee and wait, remember this is a 115200 bauds, what its ~11 kb/s