Re: [PARPORT] User space ECP


Tim Waugh (tim@cyberelk.demon.co.uk)
Sat, 17 Jul 1999 19:55:15 +0100 (GMT)


On Sat, 17 Jul 1999, Patrick Rapin wrote:

> Is there a way (somethink like ppuser) to access the parallel port
> communication functions in a user (outside of the kernel) program, and
> how?

Yes, there is. ppuser could do it for 2.2 as an add-on, and ppdev does it
for 2.3; it's merged with 2.3.10.

If you want to do IEEE 1284 negotiation _into_ ECP mode first, for 2.2 you
have to wave the control lines around yourself. For 2.3, ioctl(fd,
PPNEGOT, &mode) does the trick.

> What I wish is to be able to call functions like open, close,
> read_ecp_block and write_ecp_block inside SANE, without having to patch
> the kernel nor rewrite the IEEE 1284 protocol for ECP from scratch.

See the top of the file linux/drivers/char/ppdev.c in 2.3.10. There are
ioctls for sharing, negotiation, transfer mode settings, and
control/status/data lines, and the rest you do with read and write.

I have a demo program actually, and it's so small I may as well include it
here. deviceid just displays the device ID string from the IEEE 1284-
(but not IEEE 1284.3-) compliant peripheral on a given port. A
worth-while enhancement would be to get it to select a particular IEEE
1284.3 device first, and then it would even be able to show you IDs of
things like Zip drives.

The ppdev.o module must be loaded (or compiled in to the kernel), and
incidentally the one in 2.3.10 is broken. ;-) 2.3.11-5 has the first
useable ppdev.

Tim.
*/




This archive was generated by hypermail 2.0b3 on Sat 17 Jul 1999 - 15:00:03 EDT