As I was looking at the code, I noticed that several others of the reader processes in the fujitsu driver have the same sort of bug. My scanner isn't invoking them so I didn't write a patch since I can't test it. But it looked like color and duplex scanners might run into it too.
Thanks, Stefanie Oliver Schirrmeister wrote: >Hi, > >yes, that seems to be a bug. I'll put you patch into to cvs >the next days. > >Tanks > >Oliver > >Am Donnerstag, 6. Oktober 2005 21:11 schrieb Stefanie Tellex: > > >>Hi, >> >>I think I fixed the problem. The SCSI read was returning EOF, and the >>driver wasn't incrementing its buffers properly in that case. I changed >>it so it doesn't do anything special on EOF, and always increments by >>i_data_read, and it seems to work now. Here's a patch against the >>latest source: >> >>Maybe the USB interface caused an EOF that wasn't getting sent with >>plain SCSI? >> >> >>Index: backend/fujitsu.c >>=================================================================== >>RCS file: /cvsroot/sane/sane-backends/backend/fujitsu.c,v >>retrieving revision 1.32 >>diff -r1.32 fujitsu.c >>3814d3813 >>< break; >>3816,3819d3814 >>< DBG (10, "reader_process: EOM (no more data) length = %d\n", >>< i_data_read); >>< data_to_read -= i_data_read; >>< i_data_left = data_to_read; >>3831c3826 >>< i_data_left -= data_to_read; >>--- >> >> > i_data_left -= i_data_read; >> >>patch (END) >> >>Stefanie >> >>Stefanie Tellex wrote: >> >> >>>Hello, >>> >>>I have a Fujitsu M3093DG scanner connected via a Microtech >>>USB-SCSI-DB25 cable to a Debian DNU/Linux testing system, with sane >>>1.0.16-2. >>> >>>scanimage seems to talk to the scanner to some degree: it returns >>>reasonable error messages when the ADF is jammed or when there's >>>nothing in the feeder, and it switches between the ADF and the >>>document tray correctly when I pass the --source option. >>> >>>However, when I run scanimage, it returns very quickly (well before >>>the scanner has stopped), and the image file is corrupt. I tried both >>>pnm and tiff formats, and gimp couldn't load either one. When I ran >>>sane-troubleshoot, the image was black once, and black with stripes once. >>>I've attached the logfile from running SANE_DEBUG_FUJITSU=255 >>>scanimage 1>image.pnm 2> logfile >>> >>>Another weird thing was the first time I plugged in the scanner, it >>>got attached to lots of scsi devices. Here's the log from dmesg: >>> >>>usb 1-1: new full speed USB device using address 2 >>>SCSI subsystem initialized >>>Initializing USB Mass Storage driver... >>>usb-storage: This device (07af,0004,0100 S 06 P 50) has unneeded >>>SubClass and Protocol entries in unusual_devs.h >>> Please send a copy of this message to >>><linux-usb-de...@lists.sourceforge.net> >>>scsi0 : SCSI emulation for USB Mass Storage devices >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>>Attached scsi generic sg0 at scsi0, channel 0, id 1, lun 0, type 6 >>>Attached scsi generic sg1 at scsi0, channel 0, id 2, lun 0, type 6 >>>Attached scsi generic sg2 at scsi0, channel 0, id 3, lun 0, type 6 >>>Attached scsi generic sg3 at scsi0, channel 0, id 4, lun 0, type 6 >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>>Attached scsi generic sg4 at scsi0, channel 0, id 5, lun 0, type 6 >>> Vendor: FUJITSU Model: M3093DGdim Rev: 02 >>> Type: Scanner ANSI SCSI revision: 02 >>>Attached scsi generic sg5 at scsi0, channel 0, id 6, lun 0, type 6 >>>USB Mass Storage device found at 2 >>>usbcore: registered new driver usb-storage >>>USB Mass Storage support registered. >>> >>> >>>I played around with unplugging and replugging it in, and I changed >>>the scsi ID on the dial, and then it only made one /dev/sg* drive. I >>>plugged and unplugged it a few more times and now it won't detect it >>>at all. >>> >>>Thanks in advance for your help! >>> >>>Stefanie >>> >>>------------------------------------------------------------------------ >>> >>>[sanei_debug] Setting debug level of fujitsu to 255. >>>[fujitsu] sane_init >>>[fujitsu] sane_init: reading config file fujitsu.conf >>>[fujitsu] attach_scanner: /dev/sg0 >>>[fujitsu] attach_scanner: opening /dev/sg0 >>>[fujitsu] attachScanner opening SCSI device >>>[fujitsu] identify_scanner >>>[fujitsu] do_inquiry >>>[fujitsu] inquiry >>>[fujitsu] 000: 12 00 00 00 60 00 >>>[fujitsu] try inquiry 0 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 12 00 00 00 60 00 >>>[fujitsu] sanei_scsi_cmd: returning 96 bytes: >>>[fujitsu] >rslt> >>>[fujitsu] 000: 06 00 02 02 5b 00 00 10 46 55 4a 49 54 53 55 20 >>>[fujitsu] 010: 4d 33 30 39 33 44 47 64 69 6d 20 20 20 20 20 20 >>>[fujitsu] 020: 30 32 20 20 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] Found FUJITSU scanner M3093DGdim version 02 on device /dev/sg0, >>>treating as 3093 [fujitsu] get_vital_product_data >>>[fujitsu] get_vital_product_data >>>[fujitsu] 000: 12 01 f0 00 64 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 12 01 f0 00 64 00 >>>[fujitsu] sanei_scsi_cmd: returning 100 bytes: >>>[fujitsu] >rslt> >>>[fujitsu] 000: 06 f0 02 00 5f 01 90 01 90 11 03 20 03 20 00 32 >>>[fujitsu] 010: 00 32 ff fe 00 00 0d 80 00 00 15 e0 0f 00 00 00 >>>[fujitsu] 020: d0 08 00 80 00 00 00 00 ed bf 00 01 00 00 00 00 >>>[fujitsu] 030: 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 050: 00 00 ff ff ff 00 48 38 ff 60 e0 00 00 00 00 00 >>>[fujitsu] standard options >>>[fujitsu] basic x res: 400 dpi >>>[fujitsu] basic y res: 400 dpi >>>[fujitsu] step x res 1 dpi >>>[fujitsu] step y res 1 dpi >>>[fujitsu] max x res 800 dpi >>>[fujitsu] max y res 800 dpi >>>[fujitsu] min x res 50 dpi >>>[fujitsu] max y res 50 dpi >>>[fujitsu] window width 21.95 cm >>>[fujitsu] window length 35.56 cm >>>[fujitsu] functions: >>>[fujitsu] binary scanning: 1 >>>[fujitsu] gray scanning: 1 >>>[fujitsu] half-tone scanning: 1 >>>[fujitsu] color binary scanning: 0 >>>[fujitsu] color scanning: 0 >>>[fujitsu] color half-tone scanning: 0 >>>[fujitsu] image memory: 8388608 bytes >>>[fujitsu] physical functions: >>>[fujitsu] operator panel 0 >>>[fujitsu] barcode 0 >>>[fujitsu] endorser 0 >>>[fujitsu] duplex 1 >>>[fujitsu] flatbed 1 >>>[fujitsu] adf 1 >>>[fujitsu] image control functions: >>>[fujitsu] brightness steps: 255 >>>[fujitsu] threshold steps: 255 >>>[fujitsu] contrast steps: 255 >>>[fujitsu] number of build in gamma patterns: 3 >>>[fujitsu] number of download gamma patterns: 8 >>>[fujitsu] compression processing functions: >>>[fujitsu] compression MR: 1 >>>[fujitsu] compression MR: 1 >>>[fujitsu] compression MMR: 1 >>>[fujitsu] compression JBIG: 0 >>>[fujitsu] compression JPG1: 0 >>>[fujitsu] compression JPG2: 0 >>>[fujitsu] compression JPG3: 0 >>>[fujitsu] image processing functions: >>>[fujitsu] black and white reverse: 1 >>>[fujitsu] automatic binary DTC: 1 >>>[fujitsu] simplified DTC: 1 >>>[fujitsu] autline extraction: 1 >>>[fujitsu] image emphasis: 1 >>>[fujitsu] automatic separation: 1 >>>[fujitsu] mirror image: 1 >>>[fujitsu] white level follower: 1 >>>[fujitsu] >>> >>>[fujitsu] range: 14382268 23304601 >>>[fujitsu] ADF: present >>>[fujitsu] Duplex Unit: present >>>[fujitsu] Duplex Raster Offset: 0 >>>[fujitsu] Color Raster Offset: 0 >>>[fujitsu] attach_scanner: done >>>[fujitsu] sane_get_devices 0 >>>[fujitsu] sane_open: device /dev/sg0 requested >>>[fujitsu] sane_open: device /dev/sg0 found >>>[fujitsu] init_options >>>[fujitsu] init_options: set compression 1 >>>[fujitsu] ok compression 1 >>>[fujitsu] init_options:ok >>>[fujitsu] calculateDerivedValues >>>[fujitsu] top_margin: 0 >>>[fujitsu] left_margin: 0 >>>[fujitsu] scan_width: 0 >>>[fujitsu] scan_height: 0 >>>[fujitsu] calculateDerivedValues: ok >>>[fujitsu] sane_control_option: get value "filler" >>>[fujitsu] cap = 4 >>>[fujitsu] sane_control_option: get value "filler" >>>[fujitsu] cap = 4 >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "source" >>>[fujitsu] sane_get_option_descriptor: "mode" >>>[fujitsu] sane_get_option_descriptor: "duplex" >>>[fujitsu] sane_get_option_descriptor: "resolution" >>>[fujitsu] sane_get_option_descriptor: "y-resolution" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "tl-x" >>>[fujitsu] sane_get_option_descriptor: "tl-y" >>>[fujitsu] sane_get_option_descriptor: "br-x" >>>[fujitsu] sane_control_option: get value "br-x" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_get_option_descriptor: "br-y" >>>[fujitsu] sane_control_option: get value "br-y" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_get_option_descriptor: "pagewidth" >>>[fujitsu] sane_get_option_descriptor: "pageheight" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "averaging" >>>[fujitsu] sane_get_option_descriptor: "brightness" >>>[fujitsu] sane_get_option_descriptor: "threshold" >>>[fujitsu] sane_get_option_descriptor: "contrast" >>>[fujitsu] sane_get_option_descriptor: "rif" >>>[fujitsu] sane_get_option_descriptor: "compression" >>>[fujitsu] sane_get_option_descriptor: "compressionarg" >>>[fujitsu] sane_get_option_descriptor: "dtcselection" >>>[fujitsu] sane_get_option_descriptor: "gamma" >>>[fujitsu] sane_get_option_descriptor: "outline" >>>[fujitsu] sane_get_option_descriptor: "emphasis" >>>[fujitsu] sane_get_option_descriptor: "autoseparation" >>>[fujitsu] sane_get_option_descriptor: "mirroring" >>>[fujitsu] sane_get_option_descriptor: "variancerate" >>>[fujitsu] sane_get_option_descriptor: "thresholdcurve" >>>[fujitsu] sane_get_option_descriptor: "gradation" >>>[fujitsu] sane_get_option_descriptor: "smoothingmode" >>>[fujitsu] sane_get_option_descriptor: "filtering" >>>[fujitsu] sane_get_option_descriptor: "background" >>>[fujitsu] sane_get_option_descriptor: "noiseremoval" >>>[fujitsu] sane_get_option_descriptor: "matrix2x2" >>>[fujitsu] sane_get_option_descriptor: "matrix3x3" >>>[fujitsu] sane_get_option_descriptor: "matrix4x4" >>>[fujitsu] sane_get_option_descriptor: "matrix5x5" >>>[fujitsu] sane_get_option_descriptor: "whitelevelfollow" >>>[fujitsu] sane_get_option_descriptor: "papersize" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "orientation" >>>[fujitsu] sane_get_option_descriptor: "dropoutcolor" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "lampcolor" >>>[fujitsu] sane_get_option_descriptor: "blueoffset" >>>[fujitsu] sane_get_option_descriptor: "greenoffset" >>>[fujitsu] sane_get_option_descriptor: "swapfile" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "filler" >>>[fujitsu] sane_get_option_descriptor: "sleeptimer" >>>[fujitsu] sane_control_option: get value "tl-x" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_control_option: get value "tl-y" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_control_option: get value "tl-x" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_get_option_descriptor: "br-x" >>>[fujitsu] sane_control_option: set value "br-x" >>>[fujitsu] calculateDerivedValues >>>[fujitsu] top_margin: 0 >>>[fujitsu] left_margin: 0 >>>[fujitsu] scan_width: 10199 >>>[fujitsu] scan_height: 14031 >>>[fujitsu] calculateDerivedValues: ok >>>scanimage: rounded value of br-x from 215.9 to 215.893 >>>[fujitsu] sane_control_option: get value "tl-y" >>>[fujitsu] cap = 5 >>>[fujitsu] sane_get_option_descriptor: "br-y" >>>[fujitsu] sane_control_option: set value "br-y" >>>[fujitsu] calculateDerivedValues >>>[fujitsu] top_margin: 0 >>>[fujitsu] left_margin: 0 >>>[fujitsu] scan_width: 10199 >>>[fujitsu] scan_height: 14031 >>>[fujitsu] calculateDerivedValues: ok >>>scanimage: rounded value of br-y from 297 to 296.994 >>>[fujitsu] sane_start >>>[fujitsu] object_count = 0 >>>[fujitsu] duplex_mode = DUPLEX_FRONT >>>[fujitsu] use_temp_file = no >>>[fujitsu] sane_start opening SCSI device >>>[fujitsu] grab_scanner >>>[fujitsu] wait_scanner >>>[fujitsu] test_unit_ready >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] wait_scanner: ok >>>[fujitsu] reserve_unit >>>[fujitsu] 000: 16 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 16 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] grab_scanner: ok >>>[fujitsu] set_mode_params >>>[fujitsu] set_mode_params: ok >>>[fujitsu] send >>>[fujitsu] send: ok >>>[fujitsu] object_position: load >>>[fujitsu] object_position >>>[fujitsu] 000: 31 01 00 00 00 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 31 01 00 00 00 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] wait_scanner >>>[fujitsu] test_unit_ready >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] wait_scanner: ok >>>[fujitsu] object_position: ok >>>[fujitsu] wait_scanner >>>[fujitsu] test_unit_ready >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 00 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] wait_scanner: ok >>>[fujitsu] set_window_param >>>[fujitsu] Window set >>>[fujitsu] 000: 00 00 01 2c 01 2c 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 010: 27 d7 00 00 36 cf 00 00 00 02 08 00 00 00 00 00 >>>[fujitsu] 020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 >>>[fujitsu] 030: 20 00 00 00 00 84 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 24 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 >>>[fujitsu] 010: 00 40 00 00 01 2c 01 2c 00 00 00 00 00 00 00 00 >>>[fujitsu] 020: 00 00 27 d7 00 00 36 cf 00 00 00 02 08 00 00 00 >>>[fujitsu] 030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 040: 00 a0 20 00 00 00 00 84 00 00 00 00 00 00 00 00 >>>[fujitsu] 050: 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] set_window_param: ok >>>[fujitsu] calculateDerivedValues >>>[fujitsu] top_margin: 0 >>>[fujitsu] left_margin: 0 >>>[fujitsu] scan_width: 10199 >>>[fujitsu] scan_height: 14031 >>>[fujitsu] calculateDerivedValues: ok >>>[fujitsu] bytes per line = 2549 >>>[fujitsu] pixels_per_line = 2549 >>>[fujitsu] lines = 3507 >>>[fujitsu] brightness (halftone) = 0 >>>[fujitsu] threshold (line art) = 0 >>>[fujitsu] start_scan >>>[fujitsu] start_scan >>>[fujitsu] 000: 1b 00 00 00 01 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 1b 00 00 00 01 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] start_scan:ok >>>[fujitsu] reader_process started >>>[fujitsu] reader_process: starting to READ data >>>[fujitsu] read_large_data_block requested 30588 bytes >>>[fujitsu] <cmd< >>>[fujitsu] 000: 28 00 00 00 00 00 00 77 7c 00 >>>[fujitsu] sane_start: ok >>>[fujitsu] sane_get_parameters >>>[fujitsu] calculateDerivedValues >>>[fujitsu] top_margin: 0 >>>[fujitsu] left_margin: 0 >>>[fujitsu] scan_width: 10199 >>>[fujitsu] scan_height: 14031 >>>[fujitsu] calculateDerivedValues: ok >>>[fujitsu] depth 8 >>>[fujitsu] lines 3507 >>>[fujitsu] pixels_per_line 2549 >>>[fujitsu] bytes_per_line 2549 >>>[fujitsu] sane_read, object_count=1 >>>[fujitsu] 0/0/0: Scanner ready >>>[fujitsu] sanei_scsi_cmd: returning 0x00000005 >>>[fujitsu] sanei_scsi_cmd: returning 30588 bytes: >>>[fujitsu] >rslt> >>>[fujitsu] 000: 00 00 00 00 00 00 00 40 00 00 01 2c 01 2c 00 00 >>>[fujitsu] 010: 00 00 00 00 00 00 00 00 27 d7 00 00 36 cf 00 00 >>>[fujitsu] 020: 00 02 08 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 030: 00 00 00 00 00 00 00 a0 20 00 00 00 00 84 00 00 >>>[fujitsu] 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>>[fujitsu] 050: 00 00 ff ff ff 00 48 38 ff 60 e0 00 00 00 00 00 >>>[fujitsu] reader_process: EOM (no more data) length = 30588 >>>[fujitsu] sane_read: read 28672 bytes of 32768 >>>[fujitsu] sane_read, object_count=1 >>>[fujitsu] sane_read: read 1916 bytes of 32768 >>>[fujitsu] sane_read, object_count=1 >>>[fujitsu] reader_process(generic): buffer of 0 bytes read; 0 bytes to go >>>[fujitsu] sane_read: read 0 bytes of 32768 >>>[fujitsu] sane_read: pipe closed >>>[fujitsu] sane_cancel >>>[fujitsu] do_cancel >>>[fujitsu] do_cancel: kill reader_process >>>[fujitsu] wait for scanner to stop >>>[fujitsu] free_scanner >>>[fujitsu] release_unit >>>[fujitsu] 000: 17 00 00 00 00 00 >>>[fujitsu] <cmd< >>>[fujitsu] 000: 17 00 00 00 00 00 >>>[fujitsu] sanei_scsi_cmd: returning 0 bytes: >>>[fujitsu] free_scanner: ok >>>[fujitsu] do_cancel: close filedescriptor >>>[fujitsu] sane_close >>>[fujitsu] sane_exit >>> >>> > > >