[ BitWizard B.V. ] [ BitWizard B.V. ]

Linux par port bit level driver


What is it?

The "par" driver allows you to easily control separate bits of the parallel port device. If you want to have a few LEDs or other hardware, the parallel port is the ideal device.

Upto now however there were two reasons to not use the parallel port for this purpose. First programming the parallel port takes a little bit-fiddling, which people look up to. Secondly lots of people seem to think that driving a LED from the parallel port is impossible or might damage the port.

Well, the driver that this page is all about certainly alleviates the first problem. About the second problem: My experience as an electrical engineer tells me that most current chips can easily drive a normal LED. If you follow the instructions in the driver, I don't think you will damage your hardware. However I can not offer any guarantees. If you do blow up your hardware you most likely made an error, or I might have been wrong all along.

Changing an output can be as simple as the shell statement

	echo -n 1 > /dev/par1b
Reading a control line can be done from a C program with
	char val;
	read (parfd,&val,1);
This will block until the input changes value (the first read won't block for you to get the current value when your program starts :-).

I appreciate feedback. One of the things that I still want implemented is something that allows you to "upload" a simple script that will in the kernel execute a sequence of events. This might be needed for timing reasons or to reduce the amount of overhead on a low-end PC. If you're interested in implementing this, contact me first, I have some views about what would be a clean way to implement it and what wouldn't.....

Status

The "read" code hasn't been tested. It probably doesn't work. I've simplified the driver a bit from a previous version. It no longer optimizes the poll function away if there are no readers.

You should read the comments in the C file for more info. The whole package is a diff against the 2.4.0 kernel.