From nobody@FreeBSD.org  Thu Dec 16 16:39:38 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BEBE316A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2004 16:39:38 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8B04F43D39
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2004 16:39:38 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iBGGdbAI079809
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Dec 2004 16:39:38 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iBGGdbDQ079808;
	Thu, 16 Dec 2004 16:39:37 GMT
	(envelope-from nobody)
Message-Id: <200412161639.iBGGdbDQ079808@www.freebsd.org>
Date: Thu, 16 Dec 2004 16:39:37 GMT
From: Hernn Di Pietro <hernandp@speedy.com.ar>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Cannot print to /dev/lpt0 with HP Laserjet 1005 : Device Busy
X-Send-Pr-Version: www-2.3

>Number:         75157
>Category:       kern
>Synopsis:       Cannot print to /dev/lpt0 with HP Laserjet 1005 : Device Busy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 16 16:40:17 GMT 2004
>Closed-Date:    
>Last-Modified:  Sun Jun 14 08:10:01 UTC 2009
>Originator:     Hernn Di Pietro
>Release:        FreeBSD 5.3 RELEASE, i386, Generic Kernel
>Organization:
>Environment:
FreeBSD  5.3-RELEASE GENERIC i386
>Description:
Cannot print files to /dev/lpt0 with a Parallel HP Laserjet 1005 after
successfully uploading the HP Laserjet 1005 firmware.

Note that you can't upload anything with interrupt-driven port. If lpt
is set to polled mode with lptcontrol, it's possible to upload the 
firmware to the printer.

Seems that's a timing problem, because the firmware can be successfully
uploaded through the parallel port ONLY when the printer is powering up.
If you leave the printer ON for some seconds after powerup tasks,
sending the firmware with cat will output a Device Busy message.

>How-To-Repeat:
* In interrupt-driven port, just try to send anything to the port, it won't respond.

* Set the port with lptcontrol at boot time to polled mode (-p). Turn off the printer. When the printer is powering up, send the HP 1005 firmware with 

cat Hp1005fw > /dev/lpt0

the firmware is uploaded correctly (you can check this because when you bootup the system the next time it will identify the printer with a string like):

ppc0: HP Laserjet 1005...... 200302xx

When the firmware is not loaded, it will just report the printer name, not any feature or manufacturing date.

Note that in Linux, this firmware uploading is required, and it can be done like in FreeBSD, altough it's possible to send any job to the printer. In FreeBSD, even with the firmware loaded, the printer does not respond. 
>Fix:
The HP Laserjet 1005 firmware can be successfully uploaded to the printer if you set lpt to polling mode (device.hints at loader.conf w/ACPI disabled to avoid ACPI to reset the port to interrupt-driven). After bootup, turn off the printer. Type the command to upload the printer firmware, but do not press ENTER. Just execute the cat hp1005fw>/dev/lpt0 when the printer is doing the powerup tests. THe firmware will be successfully loaded.

After that, it won't respond to printing requests (Device busy error).
>Release-Note:
>Audit-Trail:

From: Ted Mittelstaedt <tedm@mittelstaedt.us>
To: freebsd-gnats-submit@FreeBSD.org, hernandp@speedy.com.ar
Cc:  
Subject: Re: kern/75157: Cannot print to /dev/lpt0 with HP Laserjet 1005 :
 Device Busy
Date: Sat, 13 Jun 2009 14:13:27 -0700

 This problem also exists on my Emachines Celeron 600 running
 FreeBSD 6.4 using the escputil program with an Epson printer.
 I have the parallel port set to NIBBLE mode that may be part
 of the problem.  However, the Epson has to use NIBBLE mode to
 talk to the computer.  Here's a snippet of the dmesg:
 
 ppc0: <ECP parallel printer port> port 0x378-0x37f,0x778-0x77f irq 7 drq 
 3 flags 0x1 on acpi0
 ppc0: Generic chipset (NIBBLE-only) in NIBBLE mode
 ppbus0: <Parallel port bus> on ppc0
 ppbus0: IEEE1284 device found /NIBBLE
 Probing for PnP devices on ppbus0:
 ppbus0: <EPSON Stylus C84> PRINTER ESCPL2,BDC,D4
 plip0: <PLIP network interface> on ppbus0
 lpt0: <Printer> on ppbus0
 lpt0: Interrupt-driven port
 ppi0: <Parallel I/O> on ppbus0
 
 cat /boot/loader.conf
 hint.ppc.0.flags="0x1"
 nat-rtr#
 
 To demonstrate the problem
 
 cd /usr/ports/print/gimp-gutenprint
 make install
 cd work/gutenprint-5.1.7/src/escputil
 make install
 
 ./escputil -i -u -r /dev/lpt0
 Escputil version 5.1.7, Copyright (C) 2000-2006 Robert Krawitz
 Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
 This is free software, and you are welcome to redistribute it
 under certain conditions; type 'escputil -l' for details.
 
 Cannot open /dev/lpt0 read/write: Device busy
 
 lptcontrol -p -d /dev/lpt0.ctl
 ./escputil -i -u -r /dev/lpt0
 Escputil version 5.1.7, Copyright (C) 2000-2006 Robert Krawitz
 Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
 This is free software, and you are welcome to redistribute it
 under certain conditions; type 'escputil -l' for details.
 
           Ink color       Percent remaining
               Black                      17
                Cyan                      29
             Magenta                      26
              Yellow                      31
 
 Setting lpt0 back to interrupt driven mode then makes the
 escputil program get the device busy error message again
 
 
 
 
 
 

From: Ted Mittelstaedt <tedm@mittelstaedt.us>
To: bug-followup@FreeBSD.org, hernandp@speedy.com.ar
Cc:  
Subject: Re: kern/75157: Cannot print to /dev/lpt0 with HP Laserjet 1005 :
 Device Busy
Date: Sun, 14 Jun 2009 01:07:10 -0700

 One more note - /usr/sbin/lpd works perfectly with the port set
 to interrupt mode.  It is only the escputil program that gets
 the Device Busy error message if the port is in interrupt mode.
>Unformatted:
