Subject: ANNOUNCE: Interrupt driven printer driver version 0.4
From: [email-masked] (Nigel Gamble)
Date: Fri, 12 Mar 1993 16:11:43 GMT
Newsgroups: comp.os.linux.announce

Version 0.4 of the interrupt driven parallel printer driver has been
uploaded to tsx-11.mit.edu:/pub/linux/BETA/lp/lpirq.4.tar.Z

If you have been having problems with abormally slow printing
and corrupted graphics printing, this driver should fix it.

This version is identical to version 0.3, except that it is compatible
with Linux 0.99pl6.

Here is the patch to go from 0.3 to 0.4:

*** lp.c.old	Sun Feb 14 18:16:33 1993
--- lp.c	Sat Mar  6 11:36:49 1993
***************
*** 405,411 ****
  	unsigned int testvalue = 0;
  	int count = 0;
  
! 	chrdev_fops6 = &lp_fops;
  	/* take on all known port values */
  	for (offset = 0; offset < LP_NO; offset++) {
  		/* write to port & read back to check */
--- 405,412 ----
  	unsigned int testvalue = 0;
  	int count = 0;
  
! 	if (register_chrdev(6,"lp",&lp_fops))
! 		printk("unable to get major 6 for line printer\n");
  	/* take on all known port values */
  	for (offset = 0; offset < LP_NO; offset++) {
  		/* write to port & read back to check */

This is the same patch for lp.c that is in linux 0.99 patch level 6, which
applied successfully to my kernel sources even with the new lp.c installed,
so check before you apply it.

For those of you who don't already have the new driver, here is the
README:

Interrupt driven parallel printer driver, version 0.4
-----------------------------------------------------
Nigel Gamble, 6 Mar 1993.
uunet!gamble!nigel
[email-masked]

This new version of the Linux parallel printer driver makes use of the
interrupt hardware that is present on most of the I/O cards in use
on machines capable of running Linux.  It is much more efficient than
the existing driver (which uses over 20% cpu while printing a
ghostscript graphics file on my Epson compatible 9-pin dot-matix
printer).  It completely eliminates the problem of slow printing
previously seen with incorrect values of LP_INIT_CHAR; in fact,
LP_INIT_CHAR and LP_INIT_TIME are not used at all by the interrupt
driver.

Installation instructions
=========================

0.	You need to have linux 0.99pl6.

1.	Look at struct lp_struct lp_table in lp.h.  The first column
	is the base address of the printer port, the second is the
	interrupt number.  My board uses interrupt 7 for 0x378 (/dev/lp1).
	A zero in this column means the the old polling driver is
	used.  I expect that this configuration will be correct
	for most people with the standard `2 serial + 1 parallel'
	I/O card, but if it's not correct for you, change it.

	If you have a sound card (e.g. Soundblaster), make sure that
	it is using a different interrupt from your printer port.

2.	Copy lp.h to /usr/src/linux/include/linux (you may wish save
	the old lp.h as lp.h.OLD first).

3.	Copy lp.c to /usr/src/linux/kernel/chr_drv (you may wish save
	the old lp.c as lp.c.OLD first).

4.	Remake and reboot the kernel as usual.

There are two new ioctls:

	ioctl(fd, LPSETIRQ, irq);

can be used to change the interrupt number used without recompiling
and rebooting.  The source of a simple program, lpcntl.c, is included
which calls the ioctl, so

	lpcntl /dev/lp1 0

can be used to switch to the polling driver, and

	lpcntl /dev/lp1 7

can be used to switch back to the interrupt driver using interrupt 7.
Note that you need to be super-user to change the interrupt number.

	ioctl(fd, LPGETIRQ);

returns the current interrupt number, and

	lpcntl /dev/lp1

(without the second argument) will print the current interrupt number.

Changes from version 0.3
========================

1.	Linux 0.99pl6 change merged.

Changes from version 0.2
========================

1.	All reported bugs fixed.

2.	Performance improvements (noticable when using a laser printer).

3.	LPSETIRQ ioctl now requires root permission.

Changes from version 0.1
========================

1.	Error handling in the polled driver fixed (supplied by
	Michael K. Johnson).

2.	Default IRQ 5 added for /dev/lp2.

3.	ioctl command LPIRQ replaced by LPSETIRQ and LPGETIRQ.

4.	lpcntl.c modified for new ioctl commands.
-- 
Nigel Gamble                                    [email-masked]
Ft. Lauderdale, FL                              uunet!gamble!nigel

-- 
Send submissions for comp.os.linux.announce to: [email-masked]