An unexpected acquaintance
The linuxcnc docs say
For (perhaps) more information than you ever wanted to know about stepper motors, search the web for “Jones on stepping motors”. A generous soul has given a great tutorial on all aspects of stepping motor operation.
So I read Jones on stepping motors and as I finished reading, saw:
The standard Linux line printer driver attaches the device
/dev/lp0
to the standard parallel port found on most PCs, and/dev/lp1
and/dev/lp2
to the optional additional parallel ports. The line printer driver has many operating modes that may be configured and tested with thetunelp
command. The default mode works, and the followingtunelp
command will restore these defaults:`tunelp /dev/lp0 -i 0 -w 0 -a off -o off -c off`
This turns off interrupts with
-i 0
so that the board need not deal with the acknowledge signal, and it uses a very brief strobe pulse with-w 0
, sets the parallel port to ignore the error signal with-a off
, ignores the status when the port is opened with-o off
, and does not check the status with each byte output with-C off
. The settings of thetunelp
options-t
and-c
should not matter because this interface is always ready and thus polling loop iteration is never required.
It’s been a long time since I conceived of and wrote tunelp
.
I had nearly forgotten about it, but I’m glad I exported full control
to user space when I did.
In a sense, I owed this to OS/2. OS/2 didn’t support the standard PC parallel port. It required that the interrupt line be connected. DOS didn’t require or use interrupts for the parallel port, so most systems didn’t connect to the interrupt line, making it impossible to print from OS/2 on those systems. Also, if my memory serves, it sent only one character per interrput. It was famously slow, and picky about printers.
When I re-wrote the Linux parallel port driver to use interrupts and not sit in a constant port-polling loop, I felt competitive. I wanted to go faster than OS/2, with lower CPU overhead, regardless of whether interrupts were available.
I succeeded.
And tunelp
allowed both going faster than OS/2 and being able to
make the system work with any printer, even ones that couldn’t
sense short strobe pulses.
And now I learn that it also was handy for controlling stepper motors.