Playing around with Radiotftp without any Radio

You don’t have UHX1, Bim2A or any other similar devices, but you still want to play around with radiotftp maybe even develop some software of your own on our IP stack? Go ahead you can easily do this stuff with using virtual pipes in Linux with a help of little software called socat. Here is how!

You can create virtual serial ports using a software called socat in Linux.

To install radiotftp:

  • Clone the radiotftp repository to your home directory.
cd ~/
git clone https://github.com/alpsayin/radiotftp.git
cd ~/radiotftp
  • You should select the ax25 build, so cd into the ax_25 build folder.
cd ax25_build/
  • It is always good practice to clean and then make. So clean and make.
make clean && make
  • If you are seeing “Finished building target: radiotftp“, you are almost good to go. Now  we are going to create symbolic links to binary files so that we access them anywhere.
sudo ln -s ~/radiotftp/ax25_build/radiotftp /usr/sbin/radiotftp
  • Go to your home directory again and try typing radiotftp, if you get the help text, then you are good to go
radiotftp sends or listens for a tftp request
legal invocations:
 radiotftp_uhf
 radiotftp_vhf
Build Date: Apr 4 2013 12:54:33
Uses ax25 link layer
radiotftp mode [-dst] [-b] [-f] terminal [command filename] 
 mode uhf or vhf -b run in background (EXPERIMENTAL, do NOT use this!)
 -f defines a different local filename for put and get
 and defines a different remote filename for append and appendline
 -dstXXX.XXX.XXX.XXX sends the request to XXX.XXX.XXX.XXX
 default is broadcast Local address settings are read from a 'radiotftp.conf' file
 Examples: 
 radiotftp uhf /dev/ttyUSB0 
 radiotftp uhf -flocalphoto.jpg /dev/ttyUSB0 get remotephoto.jpg
 radiotftp uhf -flocalmusic.mp3 /dev/ttyUSB0 put remotemusic.mp3
 radiotftp vhf -dst10.0.0.1 /dev/ttyUSB0 appendfile logfile.txt
 radiotftp vhf -fremote_sensors.dat /dev/ttyUSB0 appendline '{TELEMETRY BATTERY=3.3V}'
exiting...

To install socat:

  • Install socat using apt-get.
sudo apt-get install socat
  • After that you can easily create two virtual serial ports connected to each other by entering the command below.
socat -d -d pty,raw,echo=0 pty,raw,echo=0
  • This will output something like below
2013/04/09 16:00:45 socat[4468] N PTY is /dev/pts/4
2013/04/09 16:00:45 socat[4468] N PTY is /dev/pts/5
2013/04/09 16:00:45 socat[4468] N starting data transfer loop with FDs [3,3] and [5,5]
  • After this you can use radiotftp as usual but using /dev/pts/4 instead of /dev/ttyUSB0. Type in the command below in a terminal to start the server.
radiotftp uhf /dev/pts/4
  • And in a new terminal and in a DIFFERENT directory you start sending files.
radiotftp uhf /dev/pts/5 put localdata.txt
  • You should start seeing the data flow in both terminals. Ta da! Start playing with radiotftp and start exploring it. And if you are into it try developing your applications for the radiotftp stack.
Radiotftp with Socat
Radiotftp with Socat

Finally; remember that there isn’t much documentation about this on the internet. So if you have a question, ask it below and I’ll try to answer. In such way we can build up a knowledge base.