Quozl's Kitsrus Kit 74 Distributed Event Notifier

| quozl@us.netrek.org | up |

2009-05-17
Update: the code has been changed from using direct /dev/port access for legacy parallel ports, to using /dev/parport0 style access ... supports PCI and USB based parallel ports.

The source code is kept in my darcs repository. The old direct access program is k74.c, the new one is k74-ppdev.c

Thanks to Jeff Piazza for testing a similar method.


2008-04-16
Strange uses for a parallel port.

Building on his previous work in 2000, Quozl has enhanced his Kitsrus Parallel Port Utility Programs (below) to fit a special case.

Quozl uses his k74 now as an event notifier. When particular events occur, one of the LEDs and relays is turned on. When Quozl has responded to the event, it is turned off using keyboard shortcuts. The array of LEDs then becomes a list of things to do.

For example:

LEDMeaningImplementation
1Work trouble ticket arrivedtrigger script
2Work e-mail arrivedprocmailrc rule
3End of work daycrontab entry
4Coffee breakcrontab entry
5Home e-mail arrivedprocmailrc rule
6Wife e-mail arrivedprocmailrc rule
7Internet connection lostppp ip-down.d script
8OpenVPN connection lostopenvpn/client.conf route-up script

Particularly important events can then be linked through the relays to various sound or visual cue devices, according to changing priorities.

But the coffee machine is in a different room. While responding to the coffee break alarm, standing in the other room, other alarms cannot be seen easily.

So a remote graphical interface was written. It has two parts, a server which extends the local k74 driven parallel port over TCP/IP, and a client that connects to the server.

Server - k74 watch

New code was added to k74.c to watch the port pin states and report them to the output file descriptor when they change. This watch function is then started from either the command line using k74 watch or from inetd.conf. On initial connection, the current state is reported. The inetd.conf fragment is:

7299 stream tcp nowait root /usr/local/bin/k74 k74 watch

Client - k74-view

A Python Pygame network client was written to connect to the server, replicate the eight bit LED display, report state changes using sound effects, and allow the bits to be set or cleared using mouse or keyboard control. The set and clear commands are sent using new connections back to the server, one connection per action.

Here is a screen shot of the network client window with LEDs 2, 4 and 5 turned on. The --horizontal option was used.

The image is assembled from components:

LED off (made with The Gimp)
LED on (made with The Gimp)
Stars (from Netrek)

Server - k74

Lastly, the server that has the LED array attached also has to receive the turn on or turn off requests.

7201 stream tcp nowait root /usr/local/bin/k74 k74 0 set
7202 stream tcp nowait root /usr/local/bin/k74 k74 1 set
7203 stream tcp nowait root /usr/local/bin/k74 k74 2 set
7204 stream tcp nowait root /usr/local/bin/k74 k74 3 set
7205 stream tcp nowait root /usr/local/bin/k74 k74 4 set
7206 stream tcp nowait root /usr/local/bin/k74 k74 5 set
7207 stream tcp nowait root /usr/local/bin/k74 k74 6 set
7208 stream tcp nowait root /usr/local/bin/k74 k74 7 set
7301 stream tcp nowait root /usr/local/bin/k74 k74 0 clear
7302 stream tcp nowait root /usr/local/bin/k74 k74 1 clear
7303 stream tcp nowait root /usr/local/bin/k74 k74 2 clear
7304 stream tcp nowait root /usr/local/bin/k74 k74 3 clear
7305 stream tcp nowait root /usr/local/bin/k74 k74 4 clear
7306 stream tcp nowait root /usr/local/bin/k74 k74 5 clear
7307 stream tcp nowait root /usr/local/bin/k74 k74 6 clear
7308 stream tcp nowait root /usr/local/bin/k74 k74 7 clear

Source Code

The source code for the k74 and k74-view programs is kept in my darcs repository.


2000-09-08

Kitsrus Parallel Port Utility Programs

Two small programs for the parallel port interface kits 74 and 118 sold by Kitsrus. Can be useful as the basis for other parallel port interface utilities.

k74

Kit 74 is an eight digital output relay driver. The program here provides a command line utility for setting, clearing, or toggling any of the eight parallel port output bits.

k118

Kit 118 is an eight input analog to digital converter, with four digital inputs and four digital outputs. The program here provides a command line utility for setting the digital output lines, and logging the input from all eight analog channels and the four digital inputs. Logging rate is variable, and the number of samples collected can be set.


| quozl@us.netrek.org | up |