*BSD News Article 22777


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!ee.und.ac.za!hippo.ru.ac.za!kudu!g89r4222
From: g89r4222@kudu.ru.ac.za (Geoff Rehmet)
Subject: [FreeBSD 1.0E] lpt.c - fix for driver hangs
Message-ID: <g89r4222.751488540@kudu>
Sender: news@hippo.ru.ac.za (Usenet News Admin)
Organization: Rhodes University, Grahamstown, South Africa
Date: Sun, 24 Oct 1993 18:49:00 GMT
Lines: 76


I have been using the lpt driver again recently under FreeBSD,
and have come up against the problem that if the active job was
deleted from the printer queue, and lpd then attempted to print
the next job, the printer driver hung up.  This appears to have
been because of a lost interrupt.

Here's my fix for the problem,

Geoff.

-----------------------------------------------------------------------
*** /sys/i386/isa/lpt.c.orig    Sat Oct 23 15:14:46 1993
--- /sys/i386/isa/lpt.c Sat Oct 23 16:50:58 1993
***************
*** 98,106 ****
  #endif
  
  void lptout();
- #ifdef DEBUG
- int lptflag = 1;
- #endif
  
  int   lptprobe(), lptattach();
  void  lptintr();
--- 98,103 ----
***************
*** 262,268 ****
                return (ENXIO);
        sc = lpt_sc + unit;
  
!       if (sc->sc_state) {
  lprintf("lp: still open\n") ;
  lprintf("still open %x\n", sc->sc_state);
                return(EBUSY);
--- 259,266 ----
                return (ENXIO);
        sc = lpt_sc + unit;
  
!         /* Only check open bit                                 
      */
!       if (sc->sc_state & OPEN) {
  lprintf("lp: still open\n") ;
  lprintf("still open %x\n", sc->sc_state);
                return(EBUSY);
***************
*** 446,452 ****
                wakeup((caddr_t)sc);
  lprintf("w ");
  return;
!       } else  sc->sc_state |= ERROR;
  lprintf("sts %x ", sts);
  }
  
--- 444,456 ----
                wakeup((caddr_t)sc);
  lprintf("w ");
  return;
!       } else  
!       {
!        sc->sc_state |= ERROR;
!        /* if(sc->sc_xfercount == 0) */
!          sc->sc_state &= ~OBUSY;      /* fool upper half into
thinking not busy */
!          wakeup((caddr_t)sc);         /* wake up upper half  
*/
!       }
  lprintf("sts %x ", sts);
  }

-----------------------------------------------------------------------
--
===========================csgr@alpha.ru.ac.za================================
 Geoff Rehmet, Parallel Processing Group, |  ____   _ o         /\
 Computer Science Department,             | ___  _-\_<,        /\/\/\
 Rhodes University, RSA.                  |     (*)/'(*)    /\/\/\/\/\