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

Marko Kohtala marko.kohtala at luukku.com
Tue Jan 11 16:44:38 EST 2005


Tim Waugh wrote:
> 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.

Ok. If we desperately try to avoid reading past the end of the ID, then I 
think it gets complicated. We'd need to take the LE and BE values and try the 
smallest of them first, and continue until we think we have end of the ID.

I can try to see if I get a patch made this week. It does not seem to be worth it.

>>+	/* 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.

The standard says it always starts from the beginning after negotiation. Do 
you think there is a device that breaks this?

Prior to the patch it did not read (much) past the end of the given buffer 
even before the patch. So if the buffer was too small it would not have read 
the Device ID to the end.

Do you think there is a need to read all the bytes from the device?

Since the Device ID reading is not used for anything else but for getting the 
parport_device_info, this could also be completely rewritten to have it just 
parse the Device ID line by line and not give it back to the caller at all.

> Tim.
> */



More information about the Linux-parport mailing list