Giter Site home page Giter Site logo

minlux / zterm Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 550 KB

Serial terminal server used to request a zmodem file transfer to remote host

CMake 1.20% C 96.76% Shell 2.04%
file-transfer zmodem hyper-terminal file-upload-server terminal-server serial serial-console rs232

zterm's Introduction

zterm

Linux base serial terminal server used to provide a simple way to transfer files to any kind of client, using zmodem protocol.

Hypter Terminal

Usecase

Imagine you are on a computer or an embedded device and you need to get files from a linux machine. However you don't have any network or data drive to get these files. The only interface which is available is a serial (RS232, UART) interface. Then zterm may be for you!

zterm is a little tool that is intended to run on the linux machine. It receives commands from the remote computer via RS232 to

  • send a list of files ("served" by the server)
  • and initiate a zmodem file transfer ("up" to the remote)

On the remote site (the client) you only need a terminal program that "understands" the zmodem protocol. On Windows Hyper Terminal is such a program.

Hypter Terminal

With the command zdir + ENTER client can request a list of files on the server.
With the command zsend <file> + ENTER the client can instruct the server to send the requested file.

Hypter Terminal

Build

The build process of zterm is based on cmake:

cd build
cmake ..
make

Usage

Server

Before you can use zterm you have to provide a "link" to the data served by zterm. zterm expects a folder zdata next to its executable containing the data. Using a symbolic link is the recommended solution. E.g.:

cd build
ln -s ~/Downloads zdata

Currently zterm is hard coded to use /dev/ttyUSB0. Its operates on 115200bps 8N1. To start it you just has to call

./zterm

from the build directory.

Client

On the client side you can use whatever terminal program you want. You just has to connect to the serial interface with 115200bps 8N1. Then you enter

  • zdir + ENTER to get a file list
  • zsend <file> + ENTER to request the file transfer. (then, on Windows Hyper Terminal for example, a popup window will appear and "receive" the file automatically)

Normally the server runs in an "endless loop". However, if the client wants to stop the server it just has to type CLIENT. Then the server will terminate and no further interaction is possible.

Internals

The actuall file listing is based on the invocation of a shell script zdir which must be located parallel to the zterm binary. The actuall file transfer is based on the invocation of a shell script zsend which must be located parallel to the zterm binary. Both must be executable!

The shell script zsend gets the requested file as first argument. It looks for that file in an subfolder zdata. zsend itself is using the linux command line tool sz for the transfer (which is part of the lszrz package, https://ohse.de/uwe/software/lrzsz.html). Possibly you need to install that package first:

sudo apt-get install lrzsz

Why is that "strange" command CLIENT to quit the server? To make long story short: I used to use zterm in a script which started first zterm and afterwards pppd. pppd allows to establish a direct cable connection DCC between a windows computer and the linux machine. Windows initiates a DDC connection, by sending the command CLIENT a few times in advance. zterm is using this a trigger to terminate so that the following pppd can be started...

zterm's People

Contributors

minlux avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

alex-kw sairuk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.