*BSD News Article 3336


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!destroyer!ncar!ico!jbsys.com!jbev
From: jbev@iscden.jbsys.com (Jim Bevier - J B Systems)
Subject: How to build & configure LPT
Message-ID: <1992Aug11.201127.1600@jbsys.com>
Sender: jbev@jbsys.com (Jim Bevier - J B Systems)
Organization: J B Systems on HiPeak, Morrison, Co.
Date: Tue, 11 Aug 1992 20:11:27 GMT
Lines: 154

I have seen several requests for information on how to install
the line printer driver lpt.c.  Well, this is what I did, and
it seems to work.  The printer must be online and ready before
starting any printing.

In /sys/i386/isa edit the file lpt.c to look like the following diffs:

------------------start diffs---------------------
*** lpt.c.std	Fri Apr 17 17:18:59 1992
--- lpt.c	Sun Aug  9 21:35:45 1992
***************
*** 46,52 ****
   * SUCH DAMAGE.
   *
   */
-  */
  
  /*
   * Device Driver for AT parallel printer port
--- 46,51 ----
***************
*** 57,69 ****
  #if NLPT > 0
  
  #include "param.h"
- #include "user.h"
  #include "buf.h"
  #include "systm.h"
- #include "kernel.h"
  #include "ioctl.h"
  #include "tty.h"
  #include "uio.h"
  
  #include "i386/isa/isa_device.h"
  #include "i386/isa/lptreg.h"
--- 56,69 ----
  #if NLPT > 0
  
  #include "param.h"
  #include "buf.h"
  #include "systm.h"
  #include "ioctl.h"
  #include "tty.h"
+ #include "proc.h"
+ #include "user.h"
  #include "uio.h"
+ #include "kernel.h"
  
  #include "i386/isa/isa_device.h"
  #include "i386/isa/lptreg.h"
-------------------------------end-------------------------

The above changes will allow the driver to be compiled without errors.
I did not change any of the driver's functionality.

Now go to /sys/i386/i386 and edit conf.c to add the lpt information:

------------------start diffs---------------------
*** conf.c.std	Sat May 30 16:48:08 1992
--- conf.c	Sun Aug  9 21:41:10 1992
*************** extern	struct tty com_tty[];
*** 165,170 ****
--- 165,179 ----
  #define	com_tty		NULL
  #endif
  
+ #include "lpt.h"
+ #if NLPT > 0
+ int	lptopen(),lptclose(),lptwrite();
+ #else
+ #define lptopen		enxio
+ #define lptclose	enxio
+ #define lptwrite	enxio
+ #endif
+ 
  int	logopen(),logclose(),logread(),logioctl(),logselect();
  
  int	ttselect(), seltrue();
*************** struct cdevsw	cdevsw[] =
*** 214,219 ****
--- 223,231 ----
  	{ asopen,	asclose,	rawread,	rawwrite,	/*D*/
  	  asioctl,	enodev,		nullop,		NULL,
  	  seltrue,	enodev,		asstrategy },
+ 	{ lptopen,	lptclose,	enodev,		lptwrite,	/*E*/
+ 	  enodev,	enodev,		nullop,		NULL,
+ 	  seltrue,	enodev,		NULL },
  };
  int	nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
  
-------------------------------end-------------------------
This will add the major character device 'E' for the printer.  You will
use `14' for the mknod later.

No go to /sys/i386/conf and edit files.i386 to include the lpt driver.

------------------start diffs---------------------
*** files.i386.std	Mon May 25 12:25:04 1992
--- files.i386	Sun Aug  9 21:25:29 1992
*************** i386/isa/isa.c		optional isa device-driv
*** 22,27 ****
--- 22,28 ----
  i386/isa/com.c		optional com device-driver
  i386/isa/npx.c		optional npx device-driver
  i386/isa/as.c		optional as device-driver
+ i386/isa/lpt.c		optional lpt device-driver
  i386/i386/db_disasm.c	optional ddb
  i386/i386/db_interface.c	optional ddb
  i386/i386/db_trace.c	optional ddb
-------------------------------end-------------------------

Now you need to modify your local configuration file by adding
the lpt device information.

Insert the device definition as:

device		lpt0	at isa? port 0x378 bio irq 7 vector lptintr

 or

device		lpt0	at isa? port "IO_LPT1" bio irq 7 vector lptintr


Now do a ``config LOCAL_CONFIG''

Now you can go to /sys/compile/LOCAL_CONFIG and do ``make depend''
and then ``make''.  This will rebuild the kernel with the printer
driver included.  Then install the new system by:
``mv /386bsd /386bsd.alt''
``cp 386bsd /''
and reboot your system.

After the system restarts, you need to make the dev entries for the
printer by:

``mknod /dev/lpt0 c 14 0''
``ln /dev/lpt0 /dev/lp''
``chmod 222 /dev/lpt0''

Now...., you are done.  So make sure your printer is connected, online,
and ready and output something to the printer, such as:

``cat /COPYRIGHT > /dev/lp''

I hope it will all work for you too!  8-)

Jim Bevier
jbev@jbsys.com

-- 
+=+     From the mountains of Colorado:   jbev@jbsys.com      +=+
+=+           when it's not snowing, the sun is shining       +=+
+=+     Jim Bevier    -   J B Systems   (303)-697-1038        +=+
+=+         10136 Horizon View, Morrison, CO 80465            +=+