In order to isolate the hardware level to a particular program, gloveread was written. This takes a continuous stream of bytes and converts them into glovedata objects before outputting them by calling printglove. It was implemented as a finite state machine that received individual bytes. This gives maximum flexibility and also also graceful recovery from bad packets.
Typically this would be combined in the way shown below:
( stty raw -parity -echo ; gloveread ) < /dev/ttyd2
This sets up the second serial port on the SGI (/dev/ttyd2) before passing the data on to gloveread. Gloveread then prints the results to STDOUT, in a comma-separated list that can be read by calling readglove on the stream, but is also human-readable.