My masters project was to write a device driver for a rather simple device, a parallel port switch.  The particular model is the ATEN AS/2 and AS/4 switches.  These switches are reversible 1-2 or 1-4 printer switches.  They are completely unsuitable for other paralell port activities such as scanners, Zip drives, or Backpack CD-ROM drives but seem to work find with printers.  The switches are sold by a variety of vendors such as PC Accessories and Fellows.  You can tell if you have one of these switches by examining the names of the drivers that come on the driver disk.  They will most likely contain the strings "as" and "152" for the two port switch or "154" for the four port switch.  They both use the same command set.  They presumably retail for $35 and $49 respectively, but I have found them for as low as $15 in most places.

Well, if you have ever attempted to write a device driver for any operating system, no matter how simple the device, if it is your first attempt at writing such a beast, you know it isn't easy.  Well, this wasn't particularly easy, but there is plenty of documentation on writing parallel port device drivers and the documentation for doing so under Linux is becoming increasingly better.  Due to the proliferation of parallel port devices, the format of the parport drivers under Linux has changed since the 2.0 kernels to make it particularly easy to write such drivers.  I was asked to do a presentation on my project and will get that on my site soon.  I wrote my driver primarily for the four port version, but was only able to test it using the two port version.  I was able to get pretty fantastic results, with printers attached to both ports printing simultaneously.  However, I never got past the stage of testing them with just plain text output on dot matrix printers.  I never tested them with graphics capabilities or on ink jet or laser printers.  Additionally, the timing is probably pretty well tuned to the machine I was testing it on, a high end 486 of some sort and may not work too well on a higher end machine.  My next objectives for this driver are to set up an interrupt handler so that it will handle data more quickly and to create an ioctl interface to lock out or lock in a port.

Where's the code I hear you all scream (cough cough).  Well here it is in all its hideousness.  I talked to my school, and no one there thought that it would be a problem putting it under the GPL.  While I haven't put the official GPL stamp on this, consider it so (although why anyone else might want to take credit for this is beyond me).  I would appreciate any additions/corrections to my code and I will attempt to incorporate any patches people send me.

 parswitch.tgz