On Fri, Nov 2, 2012 at 1:04 PM, m. allan noah <kitno455 at gmail.com> wrote: > Can you try to get some debug logs of the backend, to compare the two > programs? > > SANE_DEBUG_PNM=255 scanimage ... 2> scanimage.log > SANE_DEBUG_PNM=255 perlprog ... 2> perlprog.log > > Maybe the perl code needs an additional call somewhere, or maybe there > is a bug in the backend. >
Here are the logs. It seems there is an additional call to sane_get_parameters after the sane_start in the scanimage case, and a couple of control options at the beginning, but appart from that there is not much difference. I am also attaching the Perl code to see if we are missing something here. Thanks! -- Alejandro Imass -------------- next part -------------- #!/usr/bin/env perl use warnings; use strict; use Sane; use Data::Dumper; use feature "say"; my @devices = Sane->get_devices; my $device_name = $devices[0]->{name}; say "Device name: $device_name"; my $device = Sane::Device->open($device_name); warn 'Failed device open with'.$Sane::STATUS if $Sane::STATUS; my $fh = undef; open($fh, '>', './scanner_options.txt'); my $i = 0; while(my $option = eval{$device->get_option_descriptor($i)}){ print $fh "OPTION $i: ".Dumper($option); $i++; } close $fh; warn 'Failed device get_option_descriptor with'.$Sane::STATUS if $Sane::STATUS; my $filename = "./out1.pnm"; $device->set_option(2, $filename); $device->set_option(3, 200); warn 'Failed device set_option with'.$Sane::STATUS if $Sane::STATUS; $device->start(); warn 'Failed device start with'.$Sane::STATUS if $Sane::STATUS; my ($buf, $len, $img) = undef; do{ ($buf, $len) = $device->read(0); warn 'Failed device read with'.$Sane::STATUS if $Sane::STATUS; if($buf){ $img .= $buf; } else{ warn "NO DATA ON device->read buf:$buf len:$len!"; } }while($len); open ($fh, '>', './raw.pnm'); print $fh $img; close $fh; -------------- next part -------------- A non-text attachment was scrubbed... Name: scanimage.log Type: application/octet-stream Size: 3710 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20121102/1e0b6bfa/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: perl.log Type: application/octet-stream Size: 2246 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20121102/1e0b6bfa/attachment-0001.obj>