[sane-devel] Re: More ECP woes? Or just a strange format?

Matthew Duggan stauff@guarana.org
Tue, 23 Sep 2003 11:33:25 +1000

Ooops, forgot to use reply-all.  Here 'tis.

On Mon, Sep 22, 2003 at 09:52:30PM -0300, John Coppens wrote:
> Hello Matthew.

G'day John,

> Thanks to the ieee-lib I'm getting somewhere. I miraculously coaxed the
> camera in sending an image to me. I'm quite in the dark how things work,
> but I tried to mimic the windows behaviour.

That's great!  It's a pretty good sign if you can get anything from a
device.  I'm glad the lib was useful.

> But when I download the image I get strange values inserted at strange
> intervals, which disrupt the image, of course. Apparently the image is
> sent by default as YUV9, sending 4 lines of Y, then two half-lines as U
> and V.

That's an .. interesting.. method, but not the strangest one I've seen.  
I'd say it's a result of the way that the CCD is organised.  Most CCDs 
double-up on one of the colours to make "square" pixels, so you end up
with twice as much blue information as green/red.
The scanners we worked on had this strange 10-bit methog of interleaving 
bytes so that it grouped the colours in blocks of 5 bytes, which had 4
pixels and a catch-up byte with interleaved high-bits.  Wierd.. anyway.

> I get an extra byte after 0x2f80, then after 0x5f00, etc. The extra bytes
> seem to be random values, unrelated to the camera at first sight.
That seems like some long spacing, but they might be checksum bytes?
Try summing all the values in those ranges mod 256 and see if the
value is correct.  Lots of parport things add checksums because the
channel isn't 100% reliable.  The other option is that you can just
skip them if they're totally regular.

There's a chance that the camera has some way of resending requested
scanlines if there's been an error.. or you can just know that there's
an error and not know what to do about it :)

> I am worried about the other modules loaded. Is one of the others
> interrogating the ECP port regularly? (lp? ppdev?) How can I avoid this -
> it seems lp is loaded automatically when opening the ECP port.
lp and ppdev should be quiet unless some application requests that they
do something.  They let libieee1284 have exclusive access actually.
When you open the port using ppdev and set it to an ECP mode, it should 
give you exclusive access.  You don't get that access by using inb/outb.

> I'd appreciate suggestions...

Hope that's some help. Good luck!


- Matthew

> John