From owner-freebsd-bugs Fri Apr 13 20:50:12 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C853237B50B for ; Fri, 13 Apr 2001 20:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f3E3o0U47137; Fri, 13 Apr 2001 20:50:00 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 794C437B506 for ; Fri, 13 Apr 2001 20:49:48 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f3E3nmh47109; Fri, 13 Apr 2001 20:49:48 -0700 (PDT) (envelope-from nobody) Message-Id: <200104140349.f3E3nmh47109@freefall.freebsd.org> Date: Fri, 13 Apr 2001 20:49:48 -0700 (PDT) From: ve3wwg@home.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: i386/26562: /dev/lpt0 returns EBUSY when attempting to open "Ready Printer" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26562 >Category: i386 >Synopsis: /dev/lpt0 returns EBUSY when attempting to open "Ready Printer" >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 13 20:50:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Warren W. Gay VE3WWG >Release: 4.2-RELEASE & 4.3-RC >Organization: >Environment: FreeBSD hibiscus.ve3wwg.org 4.3-RC FreeBSD 4.3-RC #4: Fri Apr 13 23:27:07 EDT 2001 root@hibiscus.ve3wwg.org:/usr/src/sys/compile/hibiscus i386 >Description: The Canon BJC-4300 does not provide the LPS_SEL (Selected) signal (or at least, my printer is not _now_ providing this signal). Consequently, it becomes impossible to open the printer for printing under FreeBSD (printing DOES work under Windows and Linux for this printer, on this same machine, however). >How-To-Repeat: Nothing special. I tried all the BIOS and interrupt combinations, and new kernels configured to match. None of these changes mitigated the problem. I would like to suggest a kernel "option" to configure the ability to ignore the SELECT signal coming back from the printer. >Fix: Hack /usr/src/sys/dev/ppbus/lpt.c to ignore LPS_SEL. The following is context diff of the working solution (email me for an unmangled copy of this patch file, if you like): # cat patches.lpt *** lpt.c Fri Apr 13 22:28:32 2001 --- hacked.lpt.c Fri Apr 13 23:32:37 2001 *************** *** 171,183 **** /* status masks to interrogate printer status */ ! #define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */ ! #define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR) /* Printer Ready condition - from lpa.c */ /* Only used in polling code */ ! #define LPS_INVERT (LPS_NBSY | LPS_NACK | LPS_SEL | LPS_NERR) ! #define LPS_MASK (LPS_NBSY | LPS_NACK | LPS_OUT | LPS_SEL | LPS_NERR) #define NOT_READY(ppbus) ((ppb_rstr(ppbus)^LPS_INVERT)&LPS_MASK) #define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */ --- 171,183 ---- /* status masks to interrogate printer status */ ! #define RDY_MASK (/*LPS_SEL|*/LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */ ! #define LP_READY (/*LPS_SEL|*/LPS_NBSY|LPS_NERR) /* Printer Ready condition - from lpa.c */ /* Only used in polling code */ ! #define LPS_INVERT (LPS_NBSY | LPS_NACK | /*LPS_SEL |*/ LPS_NERR) ! #define LPS_MASK (LPS_NBSY | LPS_NACK | LPS_OUT | /*LPS_SEL |*/ LPS_NERR) #define NOT_READY(ppbus) ((ppb_rstr(ppbus)^LPS_INVERT)&LPS_MASK) #define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */ *************** *** 538,545 **** /* is printer online and ready for output */ } while ((ppb_rstr(ppbus) & ! (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != ! (LPS_SEL|LPS_NBSY|LPS_NERR)); sc->sc_control = LPC_SEL|LPC_NINIT; if (sc->sc_flags & LP_AUTOLF) --- 538,545 ---- /* is printer online and ready for output */ } while ((ppb_rstr(ppbus) & ! (/*LPS_SEL|*/LPS_OUT|LPS_NBSY|LPS_NERR)) != ! (/*LPS_SEL|*/LPS_NBSY|LPS_NERR)); sc->sc_control = LPC_SEL|LPC_NINIT; if (sc->sc_flags & LP_AUTOLF) *************** *** 598,605 **** /* if the last write was interrupted, don't complete it */ if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) while ((ppb_rstr(ppbus) & ! (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != ! (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) /* wait 1/4 second, give up if we get a signal */ if (tsleep((caddr_t)lptdev, LPPRI|PCATCH, "lpclose", hz) != EWOULDBLOCK) --- 598,605 ---- /* if the last write was interrupted, don't complete it */ if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) while ((ppb_rstr(ppbus) & ! (/*LPS_SEL|*/LPS_OUT|LPS_NBSY|LPS_NERR)) != ! (/*LPS_SEL|*/LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) /* wait 1/4 second, give up if we get a signal */ if (tsleep((caddr_t)lptdev, LPPRI|PCATCH, "lpclose", hz) != EWOULDBLOCK) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message