10

I have an embedded Linux on a custom board and I would like to send and receive file over its serial port.

The only way to communicate with this device is over serial and the device offers a console on this serial port.

This board doesn't have kermit neither busybox rx nor lrzsz.

- Sending file to remote

I was able to send file to the board following this thread.

Host side Remote side cat file | base64 > file_b64 cat > file_b64 minicom's ctrlA-S => send 'file_b64' cat file_b64 | base64 --decode > file 

- Getting file from remote

Now I would like to retrieve a file from remote system.

Minicom has a tool for receiving files but as I only have the serial port's console using minicom to issue commands on remote side, I can't find how to do it.

I have tried using kermit on host side but it seems that I also needs to have kermit on the remote side.


EDIT:

I have also tried to reverse the sending method but with no success as i receive nothing from serial port on host side.

Host side Remote side cat file | base64 > file_b64 (sleep 10; cat file_b64 > /dev/ttyS0) & minicom's ctrlA-X => exit minicom cat /dev/ttyUSB0 > file_b64 

Can't use minicom's receive tool cause it only support xmodem, ymodem, zmodem and kermit tranfers and not ascii.


Is there a way to retrieve files from remote without having to type commands into its console?

2
  • 2
    Why don't you use the slip module to build a tcp/ip connection? tldp.org/LDP/nag2/x-087-2-slip.operation.html Commented Aug 3, 2018 at 14:30
  • Didn't know this module, however slattach is not available on remote side Commented Aug 3, 2018 at 14:37

2 Answers 2

6

Finally found out that I was issuing the wrong command on receiver's side.

Receive command shall be : cat < /dev/ttyUSB0 > file_b64

Summary

To receive from remote :

 Host side | Remote side | | #Encode to base64 | cat file | base64 > file_b64 | | #Send after timeout | (sleep 10; cat file_b64 > /dev/ttyS0) & | ############################################################# ### Exit minicom but keep configuration (ctrlA-Z, then Q) ### ############################################################# | #Receive file | cat < /dev/ttyUSB0 > file_b64 | | #Decode file | cat file_b64 | base64 -di > file | 
6

Summarizing above posts i found something like this:

Sending.

Start receiving on target:

cat | base64 -d > filetotarget.bin 

Exit minicom with Ctrl-A + Q and then run on host machine:

cat filetotarget.bin | base64 > /dev/ttyUSB0 

Return to minicom and press Ctrl-D to finish receive process.

Receiving.

Start delayed send on target:

sleep 10 ; cat filefromtarget.bin | base64 

Exit minicom with Ctrl-A + Q. Then start receiving on host:

cat < /dev/ttyUSB0 | base64 -di > filefromtarget.bin 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.