[Linux-parport] [PATCH] IEEE1284 Device ID read fixes

Tim Waugh twaugh at redhat.com
Tue Jan 11 05:22:07 EST 2005


On Mon, Jan 10, 2005 at 08:33:35PM +0200, Marko Kohtala wrote:

> +	/* Some devices don't truly implement Device ID, but just
> +	   return constant nibble forever. This catches also those
> +	   cases. */
> +	if (idlen <= 2 || idlen > 0xFFF) {
> +		printk (KERN_DEBUG "%s: reported broken Device ID length of 
> %#zX bytes\n",
> +			port->name, idlen-2);
> +		return -EIO;
> +	}

Some manufacturers think that the first two bytes are little-endian,
so that last test will miss IDs from them altogether.  Sorry, I don't
remember which.

> +	/* Avoid reading past given ID length just in case some
> +	 * devices do not properly implement the end of data in Device
> +	 * ID nibble mode. */
> +	retval = parport_read (port, buffer+len,
> +			       min(count-len-1,idlen-2));

For some reason I had in my mind that you need to read to the end of
the data in order to make sure the device will start from the
beginning again next time.  Perhaps that's wrong.

Tim.
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-parport/attachments/20050111/ca342193/attachment.bin


More information about the Linux-parport mailing list