Close

Taste of success

A project log for Chirppp, Serial over LORA

Use LORA via GPIO and a full-duplex serial emulator for serial a connection intended for extended range use.

dominic-demarcoDominic DeMarco 07/21/2017 at 01:360 Comments

In my silence I've been working on getting pseudo-terminals (ptys) working with Rust.

For those that have never heard of a pseudo terminal before (I was one of them), this is essentially an emulated null modem connection for use in software.

SSH is one of the more popular program that makes use of this feature.

Essentially a pair of software-defined terminals are created, one master and one slave. The slave is the public facing portion of the pair, viewable in the linux filesystem, it can be read from and written to. The other end of the connection is the master pty, this one is not visible in the filesystem. It is a serial endpoint that behaves like a file that you can then interact with as you would a file in your program, reads, writes, etc.

To get this working in rust I had to use a crate that directly interfaces with libc, so through rust I was directly able to use the "openpty" C function binding, and it worked without a hitch.

This method did create some ugly platform-dependent code that I'd rather do without. I may visit how to rid myself of that later.

But for now I did an ugly little demo I screencapped and edited, so bear with me...

the left side is one device (the vocore), the right is the other (the chip), the top terminals are the output of the VERY simple version of chirppp I have working right now, the bottom is what a regular user would see with the chirppp service running on their machine.

I don't have a pretty serial terminal program that will run on both machines, so I had to communicate with the port using echos and cats, but you should get the idea...


Right now it only works as a simple back and forth with NO logic, so it does not yet operate as a true serial connection would. That's the next step. I have to mull over how I want to design the pseudo-protocol of handing packets back and forth in a way that won't chew up too much power or have too much latency.

I'll hopefully have some variations of how I want it to work in the next coming days.


Discussions