Parallel Port code for Minix 2.0

This code is what I use to access the parallel port on my 286 PC running Minix 2.0. You can find out about Minix here.

The code consists of two files, pport.h and ppout.c. A gzipped tar file with these two files is here.

The code is straightforward, the only slightly tricky thing being the method of obtaining access to the IO ports. This is done by opening /dev/mem. Only set-uid programs may do this, and the OS uses this to restrict ordinary user programs access to IO ports (as all good operating systems should).

Because of this, the executable ppout must be made setuid root. The easiest way to do this is to compile it as root, then chmod it appropriately.

As a matter of interest, ppout is used to control an interface box to the automatic sprinklers in my garden. The 286 PC is installed in my garden shed, and I have 10base-2 ethernet linking it to my house.

I have plans to connect sensors to allow the minix box to log temperature, soil moisture level etc, and then implement a closed loop control system for optimally watering my lawn. South Australia (where I live) is the dryest state in Australia, and conserving water is important. 1