Re: [PARPORT] Writing a parallel port driver

Tim Waugh (
Tue, 13 Apr 1999 22:35:18 +0100 (GMT)

On Tue, 13 Apr 1999, Eric Crampton wrote:

> I want to write a driver for an external parallel port 4-in/4-out MIDI
> interface. I've been reading kernel source code (like
> parport.h/parport.c), but I don't quite understand everything I need
> to do to make things work.


The parport interface is undergoing some changes, mainly for improved
support for IEEE 1284 transfer modes. The main change is for block
read/write operations, but there are assorted smaller changes too.

That said, the 2.2 parport interface will remain the same as long as 2.2
is the current stable branch. Are there any specific questions you have?

Basically, all you really have to do is register a device with parport,
claim it, and use the port it's on. You register with
parport_register_device; claim with parport_claim (and release with
parport_release), and use the port with the various functions in the
port->ops structure.

To find out what ports there are in 'the system', use parport_enumerate().
You get back a struct parport*, and that has a 'next'. The printer driver
has an example of walking through the list of ports.

Only one driver is allowed to use the port at any particular time, and
parport provides routines for claiming control and releasing control.
There is also a means of preempting another driver, to try to gain control
(take a look at the parameters that parport_register_device takes).

I really ought to write some proper documentation for parport sometime. I
have a text file that I wrote as a doodle -- I'll send you that. I'm
afraid it's the closest I've come to actually documenting things properly.


-- To unsubscribe, send mail to: --
-- with the single word "unsubscribe" in the body of the message. --

This archive was generated by hypermail 2.0b3 on Tue 13 Apr 1999 - 18:09:23 EDT