0

I've downloaded Gtkterm in 2 desktop systems each with a RS-232 serial port. I'm attempting to transfer a simple .txt file between the 2 systems thru one of the available serial ports. The 2 systems are connected at their respective RS-232 port using a null-modem RS232 cable.

I've selected the appropriate ttyS# port, and am sending the file on 1 computer. But, how do I read this sent file on the other computer.

jerryh91
  • 123
  • 1
  • 2
  • 6
  • Solution found, just open GtkTerm in the other system receiving the file with the correct ttyS# set, we will see the txt displayed in the console – jerryh91 Jul 20 '15 at 21:45
  • Solutions should be posted as answers, not comments, see https://askubuntu.com/help/self-answer. I’ve re-posted your comment as an answer. Feel free to re-post as an answer using your account, so you’ll get the reputation regarding to this answer. Then ping me, so I can delete my answer. – Melebius Jan 20 '20 at 08:13

3 Answers3

0

This answer was originally posted by OP as a comment.

Solution found, just open GtkTerm in the other system receiving the file with the correct ttyS# set, we will see the txt displayed in the console.

Melebius
  • 11,431
  • 9
  • 52
  • 78
0

If you have a serial login from one ubuntu workstation (local) to another ubuntu machine (remote), you can send a raw file over gtkterm with the following:

First, check the md5sum of the file so that we can be confident we transferred it successfully. If the file you wish to send is binary (contains non-ascii text) then I recommend that you first base64 encode the data. For example

[local]:

user@local:~$ md5sum my_file.bin
9426054eb507e98605d7a6b94189168b  my_file.bin
user@local:~$ base64 my_file.bin > my_file.bin.base64
user@local:~$ gtkterm --port /dev/ttyUSB1 --speed 115200 &

[remote]:

user@remote:~$ cat > my_file.bin.base64

Now use the gtkterm menu to "send raw file" and select your file. You'll see every byte of the file echo'ed on the gtkterm window. When the file is finished sending press Ctrl+D in the gtkterm window to send a EOF to cat. You'll see a new terminal prompt pop up. Then base64 decode the file. Finally it's a good idea to check the integrity of the data.

[remote]:

user@remote:~$ base64 -d my_file.bin.base64 > my_file.bin
user@remote:~$ md5sum my_file.bin
9426054eb507e98605d7a6b94189168b  my_file.bin

Notes Note that the file transfer will proceed at the rate of the serial connection. You can't feasibly send very large files this way. Furthermore (and especially if the serial connection doesn't support flow control) there's always the possibility of some dropped bytes.

*BONUS:

Once you've started cat > my_file.bin.base64 on the remote machine through gtkterm, you can bypass gtkterm to do the actual file transfer. For instance you can use plain ole cat:

[local]:

user@local:~$ cat my_file.bin > /dev/ttyUSB1

Or if you want a fancy progress bar give pv a try:

[local]:

user@local:~$ pv my_file.bin | cat > /dev/ttyUSB1

This technique will work with other serial terminal clients, including terminal based clients (i.e. creen, minicom, etc).

-1

Here's what you a gotta do:

If the name of the file is blahblah.txt

On the sending machine:

sudo cat blahblah.txt > /dev/ttyS0

On the receiving machine:

sudo cat /dev/ttyS0 > blahblah.txt

Don't forget the sudo, since some systems may need that.

Daniel
  • 3,446