Code Monkey home page Code Monkey logo

vsp-router's Introduction

Virtual Serial Port Router (vsp-router)

Build status Crates.io

Create virtual serial ports, connect them to physical serial ports, and create routes between them all.

Vsp-router was created to connect two terminal emulators to the same physical RS-232 serial console.

asciicast

Supported Operating Systems

  • Linux: Yes, tested on Red Hat Enterprise Linux 8
  • macOS: Yes, tested on macOS Ventura 13.1
  • Windows: Yes*, tested on Windows 10

*The Windows version does not support creation of virtual serial ports. A third-party tool like com0com can be used instead.

Use Cases

Multiplex two virtual serial ports to a single physical serial port.

vsp-router \
    --create 0 \
    --create 1 \
    --attach 2:/dev/ttyUSB0 \
    --route 0:2 \
    --route 1:2 \
    --route 2:0 \
    --route 2:1

Multiplex two virtual serial ports to a third virtual serial port.

vsp-router \
    --create 0 \
    --create 1 \
    --create 2 \
    --route 0:2 \
    --route 1:2 \
    --route 2:0 \
    --route 2:1

Example

In terminal A

cargo run -- \
    --create 0 \
    --create 1 \
    --create 2 \
    --route 0:2 \
    --route 1:2 \
    --route 2:0 \
    --route 2:1

In terminal 0

picocom 0

In terminal 1

picocom 1

In terminal 2

picocom 2

Characters entered in terminal 0 will be sent to terminal 2 only. Characters entered in terminal 1 will be sent to terminal 2 only. Characters entered in terminal 2 will be sent to both terminals 0 and 1.

Comparison to TTYBUS

vsp-router is similar to TTYBUS.

The key differences is in how data is written. TTYBUS broadcasts data to all ports. vsp-router routes data to select ports.

The following 3-port configurations are the equivalent.

TTYBUS

tty_bus -d -s bus
tty_fake -d -s bus 0
tty_fake -d -s bus 1
tty_fake -d -s bus 2

vsp-router

vsp-router \
    --create 0 \
    --create 1 \
    --create 2 \
    --route 0:1 \
    --route 0:2 \
    --route 1:0 \
    --route 1:2 \
    --route 2:0 \
    --route 2:1

Comparison to socat

Socat establishes a bidirectional channel between two end points. Vsp-router establishes a multi-directional channel between N end points. Socat supports several different types of end points. Vsp-router supports two: virtual serial ports and physical serial ports.

Vsp-router could be combined with socat to enable interesting use cases. For example, vsp-router could be used to snoop a physical serial port and paired with socat to send the snooped data over UDP.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

vsp-router's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vsp-router's Issues

Question: Macos compatibility

Hello guys, I was wondering if this is able to compile and run on OSX, I noticed that Apple changed the way IO is managed in the OS with DriverKit and I was wondering if the ports are created as real virtual devices

Consider renaming CLI options

Consider the following renames:

  • Rename --physical to --attach
  • Rename --virtual to --create

This came about while thinking about Windows support but it is applicable to all platforms. In Windows, it is very difficult to create virtual serial ports. It is better to defer this functionality to an external third-party solution like com0com.

So one could create virtual serial ports using com0com then use the vsp-router --physical option to attach to it but its not a physical serial port so using the --physical option to attach to it is confusing.

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.