Skip to content

Instantly share code, notes, and snippets.

@pedroduartecosta
Last active October 22, 2017 22:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroduartecosta/3661871d1e6bfb52c0f7d4ce26c0b141 to your computer and use it in GitHub Desktop.
Save pedroduartecosta/3661871d1e6bfb52c0f7d4ce26c0b141 to your computer and use it in GitHub Desktop.

Data Connection Protocol

We used a script "port.sh" that can virtual emulate a connection through a serial port, you can execute that script by running:

sh port.sh

It's recomended to install socat to use this script.

Install socat Under:

  • Debian / Ubuntu Linux:

sudo apt-get update && sudo apt-get install socat

  • Fedora:

sudo dnf update && sudo dnf install socat

Compile and Run

Open three terminals.

  1. On the first run the script:sh port.sh

  2. On the second run the make command to compile the project and then sudo ./app 0 for the sender.

  3. On the third run sudo ./app 1 for the receiver.

sudo printf "Opening virtual serial port... Done.\nPress CTRL+C at any time to close it.\n";
sudo socat PTY,link=/dev/ttyS0 PTY,link=/dev/ttyS1;
printf "\nClosing virtual serial port... Done.\n"
@inesferreira7
Copy link

Ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment