Text-only steno translation working on a Raspberry Pi

303 views
Skip to first unread message

Ian Cloud

unread,
Sep 15, 2016, 4:33:50 AM9/15/16
to Plover
I've seen that a lot of people (myself included) are interested in getting Plover working on itty-bitty Linux systems, mostly for the purpose of translating strokes as a component of a stand-alone steno keyboard that doesn't need Plover installed anywhere else. I haven't made such a stand-alone keyboard, but I've gotten as far as forking Plover and making a text-only tool out of it that takes raw qwerty steno strokes in from one named pipe and outputs the results on another, basically following Plover's arpeggiate functionality but with a newline in between strokes instead of a space.

https://github.com/KoiOates/plover

Run it with the launch.sh script (I haven't tried installing to see what would happen) and you'll have the named pipes /tmp/plovin and /tmp/plovout to work with. Once the program finishes loading all its pieces you can do things like 'echo "erfvuj" > /tmp/plovin' in one terminal or split and 'tail -f /tmp/plovout' in another and you'll see the word "Plover" in the second terminal (or its raw steno notation if the translation part of the pipeline still hasn't finished warming up).

The tool is basically just a modified Plover cut up to skip the GUI components and get the engine running. Then instead of using oslayer/xkeyboardcontrol.py for input and output, it loads oslayer/nonkeyboardcontrol.py, which is the meat and potatoes of the change. The other edits to the source code either do just enough to get nonkeyboardcontrol.py hooked up to the rest of the program or disable dependencies that are unnecessary to its basic functionality and that wouldn't run from a Raspberry Pi's terminal (or wouldn't run without having to install extra stuff).

Tested on a Raspberry Pi B+ straight from the terminal, running Raspbian. A lot of other stuff was already installed on that one, so on a clean Pi image there may still be other things to apt-get or pip install after cloning the repository that I've missed. When tested with cat and a short file of strokes, it outputted the translation a little slower than the blink of an eye but still faster than a human would type it.

Now I just need to find the time to teach my Raspberry Pi and Stenoboard to work together on this. I have a lot to learn and get in order before I can test this idea, but I was thinking the Stenoboard could either send completed strokes or a different byte for each key's up and down position over SPI to the Raspberry Pi (the pins are at least available to do this), and then the Pi can send the translation back, and the Stenoboard can send the translated keystrokes down the USB cable instead of its usual raw output that requires Plover on the other end. That would at least save the cost of another board to send the finished keystrokes.

Ty Griffin

unread,
Sep 15, 2016, 8:15:06 AM9/15/16
to Plover
Nice work!  I'm excited about the idea of Plover without a GUI. (I've always liked the GUI and it continues to get better ... just like the option to forego it in some circumstances.)

Ty 

Charles Shattuck

unread,
Sep 15, 2016, 8:18:59 PM9/15/16
to Plover
I'm really glad someone's working on this too! I'd love to be able to connect to any PC as a USB keyboard without having to add software! I fantasize that I could do it myself but realistically I never will. Thanks!

Jason Green

unread,
Sep 15, 2016, 11:12:14 PM9/15/16
to Plover
Nice work.

If you use the Raspberry Pi Zero, you can use the USB in device mode instead of USB mode (Most the other Pi's can't do device mode USB, so Zero or one of the earlier revisions of Pi are the only ones)..

So you can have the keyboard communicating over the Serial pins, and then the Pi acting as a USB Keyboard.  That way you don't have to communicate back to the keyboard.


On Thursday, September 15, 2016 at 1:33:50 AM UTC-7, Ian Cloud wrote:

Ian Cloud

unread,
Sep 16, 2016, 7:34:23 AM9/16/16
to Plover
This is some very good advice, thank you! I was originally under the impression that all Raspberry Pi's were without the capability of running as USB keyboards and that the Raspberry Pi Zero was cheap because it was just a stripped down version of the others, but now I just finished skimming the tutorials that explain how to enable the other modes. Now I have an excuse to get one of those without looking like I'm just hoarding tiny computers. And now that I've had time to digest how the Stenoboard actually works, I wonder how well things would work porting its Arduino firmware to Python and just using the GPIO pins on a Raspberry Pi Zero. This could end up being simpler than I thought if I can just swap out controllers inside of the Stenoboard instead of tacking on a new brain on top of the old one.

In the meantime, my project tonight was to see if my gutted version of Plover would run on a Pocket CHIP recently gifted to me. Updating setuptools from the wheel file (the normal pip install version didn't work) and commenting out a line of "import serial" was enough to get it running in the terminal. Like with the Pi, it took a while to start translating instead of just emitting the steno strokes to the /tmp/plovout pipe, but once it was going it was plenty quick enough to keep up with even a fast human stenographer. And I just saw a Youtube video of someone using a CHIP as a basic voice keyboard, so I'm sure it could be made to emit Plover's keystrokes as well with enough copy and pasting!

Ian Cloud

unread,
Sep 25, 2016, 6:59:21 AM9/25/16
to Plover
Quick update on standalone Plover experiment:

I could be waiting on Raspberry Pi Zero for a while (still a real hot item) but got my one PocketCHIP sending keystrokes without bricking it! It can actually do USB in and out at the same time, so I haven't had to do anything over serial pins, just added a Stenoboard mode to send a return keypress after NKRO strokes so I wouldn't have to re-rewrite parts of my original Plover modification. The C.H.I.P. community provides a lot of good info on tweaking the boards. Had to recompile the Linux kernel with HID gadget support, and then I retaught myself just enough C to make an already written keystroke sending demo, hid_gadget_test.c, slurp up the output of the /tmp/plovout pipe and send it anywhere I point the other end of the USB cable :) Just gotta finish the code for mapping non-alphabetical parts of the keyboard from Plover output and I'll put up more implementation details and source code tweaks.
Reply all
Reply to author
Forward
0 new messages