Tim Waugh (tim@cyberelk.demon.co.uk)
Wed, 20 Jan 1999 22:32:37 +0000 (GMT)
On Wed, 20 Jan 1999, Andrea Arcangeli wrote:
> There's a lot of mess in the ieee1284 detection (I never took a look at it
> before today). The _main_ problem is that only free specs I found is at
> http://www.fapo.com/ and disagree in many points with the official kernel
> code and with the new IEEE1284 patches from Tim. And the specs itself
> looks not trustable since it's buggy in some points.
Don't trust the Fapo 'specs' then.  Ask IEEE for the real document.
> So I fixed Tim's latest code for my hardware.
.. and broke it for mine.
> The most wrong thing I can
> see here is that PARPORT_STATUS_ERROR is `random' set here, and to know
> when the printer has finished I had to wait for a timeout ;). Really it's
> not random, it's set at count == 1, 2, 4, 6, 8, 9, 11, and other strange
> fixed sequence numbers. I see it completly unrealiable though. 
Then your printer is _not_ compliant.  This is exactly what I was seeing
with my printer, and exactly why I put the hack of waiting a tiny bit
before checking ERROR.  Did you try it before removing it?  Maybe the
fudge delay needs to be longer to accommodate your printer as well.
_Don't_ just eliminate code because your particular hardware doesn't need
it, and _never_ eliminate code when it does.
> This patch against the latest Tim's 1284 code I merged, fix everything
> here (P2B motherboard and Epson Stylus Color 740 printer), with this patch
> applyed both parport_probing and lp readback works fine.
Does your printer give status readback separately to device ID information
then?  What kind of thing does it say?
> @@ -392,7 +400,9 @@
>  	/* Use the mode we're in. */
>  	switch (mode) {
>  	case IEEE1284_MODE_COMPAT:
> -		if (parport_negotiate (port, IEEE1284_MODE_NIBBLE))
> +		DPRINTK (KERN_DEBUG "Going to nibble mode\n");
> +		if (parport_negotiate (port, IEEE1284_MODE_NIBBLE |
> +				       IEEE1284_DEVICEID))
>  			return -EIO;
>  	case IEEE1284_MODE_NIBBLE:
>  		DPRINTK (KERN_DEBUG "Using nibble mode\n");
Bzzzt.  This is wrong, Andrea.  We don't _always_ want device ID.  You
are right that the original code is wrong.  The correct fix is to remember
if we wanted device ID before we explicitly ignore the bit a few lines up.
> +#if 0 /* completly breaks Epson Stylus Color */
>  		/* Does the error line indicate end of data? */
>  		if (parport_read_status(port) & PARPORT_STATUS_ERROR) {
>  			port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA;
> @@ -287,6 +293,7 @@
>  			port->ieee1284.phase = IEEE1284_PH_REV_IDLE;
>  			break;
>  		}
> +#endif
>  
>  		/* Event 7: Set nAutoFd low. */
>  		parport_frob_control (port,
This is not acceptable.
> @@ -330,9 +337,6 @@
>  			count++;
>  		} else 
>  			byte = nibble;
> -
> -		/* Canon BJC-210 seems to assert nAck too early. */
> -		udelay (1);
>  	}
>  
>  	if (i == len) {
> 
> 
> I removed also Tim's printer hack ;) because it looks to me suspectious
> that there's a so silly bug in the hardware while instead everything else
> in it works fine... 
Why?  And anyway, everything else is not fine -- you said yourself that
you are not getting reliable data-ready indication.
> Comments from other parport guys?
See above. ;-)
Tim.
*/
--  To unsubscribe, send mail to: linux-parport-request@torque.net --
--  with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2.0b3 on Wed 20 Jan 1999 - 17:46:20 EST