[sane-devel] Can anyone tell me what's going on with this?

Mark Pemburn mark at pemburn.com
Mon May 18 23:41:37 UTC 2009


Thanks Julien -- that did the trick!

    I had a real "Doh!" moment when I realized that this was exactly 
what was happening (over-writing the buffer with each call to 
sane_read).  Once I set up a second buffer and appended the partial data 
to with each pass, I was finally able to see the whole beautiful scanned 
image in my UI.  Much happy dancing!  I have been trying to puzzle this 
out for _weeks_ (mostly owing to my limited experience with Objective-C 
and rusty C skills).  No comes the hard slog of getting all of the 
controls to work.

Regards,

Mark

Julien BLACHE wrote:
> Mark Pemburn <mark at pemburn.com> wrote:
>
> Hi Mark,
>
> I think you wanted to send that to the list too, but that's not what
> happened. Anyway you probably won't have to send it there :)
>
>   
>>    Well, I'm getting closer with this OS X thing.  Thanks to Julien,
>> I understand a little more about what to do what the scanner output.
>> That said, I'm still not getting the complete image into my UI and
>> I'm not sure where to look next.  Here's the current comparison
>> between my output (on the left) and that of scanimage called from
>> the command line:
>>     
>
>   
>>    while (status == SANE_STATUS_GOOD) {
>>    //*** Read the data from the scanner
>>    status = sane_read (saneHandle,imgBuff,maxlen,&bytes);
>> }
>>     
>
> Hmm, it looks like you're always passing the same pointer (imgBuff) so
> you always overwrite the data fetched by the previous call. You need
> to increment this pointer between calls.
>
> You should start by memset()ing the memory, that would probably show
> an all-black area except for the few first pixels.
>
> JB.
>
>   




More information about the sane-devel mailing list