[sane-devel] USB scanner slow, hopping back and forward

Henning Meier-Geinitz henning at meier-geinitz.de
Sat Dec 10 16:25:52 UTC 2005


Hi,

On Fri, Dec 09, 2005 at 02:29:31PM +0100, sane at rsenden.speedlinq.nl wrote:
> I've got sane installed on a LinkSys NSLU2 embedded linux device
> running the OpenSlug Linux distribution (see
> http://www.nslu2-linux.org) for use with my Trust Direct WebScan
> 19200 scanner.

Is "Trust Direct WebScan 19200" the exact name of the scanner? I'm
asking because a scanner with this exact name is not yet on our the list
of supported devices. 

Are these the ids of the scanner?
> Bus 001 Device 005: ID 055f:021c Mustek Systems, Inc. BearPaw 1200 CU Plus

> The scanner basically works, but scanning is slow due to the scanner
> hopping backwards quite often. E.g. basically it scans one
> centimeter, and then hops back half a centimeter. This happens when
> scanning A4-width at 300dpi. The higher the resolution, the smaller
> the steps get. 

That's called "backtracking" and happens when the internal buffer of
the scanner is filled completely. As the buffer has a size of only 16
kB (kilo not mega), this can happen quite quickly. In high
resolutions, this is only one scan line.

> I guess every now and then some data gets lost so the scanner has to
> rescan a line. When doing an 'export SANE_DEBUG_GT68XX=5', I see the
> following for about every 13th line (at 300dpi A4 width):

> [gt68xx] sane_read: getting line 190 of 3531
> [gt68xx] sane_read: getting line 191 of 3531
> [gt68xx] sane_read: exit (line 192 of 3531, byte_count 1987 of 2563, 32768 bytes, 491520 total)
> [gt68xx] sane_read: start (line 192 of 3531, byte_count 1987 of 2563)
> [gt68xx] sane_read: getting line 192 of 3531
> 
> Does anybody know a solutions for this? Using the scanner on a
> regular PC running Windows, scans are smooth.

I don't have this exact scanner, but with similar gt68xx devices
backtracking also occurs on Windows, but it happens less often.

> Scanning is also smooth
> on the nslu2 when scanning at low resolutions (preview) or scanning
> only a small width. Could it be that the NSLU2 is too slow for
> handling the amount of data? I've also read something about different
> ohci-drivers, but I'm not sure whether that is applicable to my
> situation, and how to find/build/use another version.

Hardware performance in general and the speed of USB drivers can make
a difference. On the same computer I have no backtracking with the one
USB host adapter and some backtracking with another one. With kernel
2.4 there were two uhci kernel drivers IIRC and one was a bit faster.
As far as I know, there is only one in 2.6.

Other tips that may reduce backtracking: Use a lower width. Sometimes
even a few mm less help. Use 8 bit/color instead of higher depths.

The gt68xx backend does its best to get the USB data as fast as
possible. It uses a reader process which is forked and constantly
tries to get data from the scanner. The only thing I'll try once it's
implemented in libusb is using non-blocking I/O. But I'm not sure yet
if that's better.

For comparison here are the scan speeds I get with Mustek Bearpaw 1200 CU Plus which
has the same USB ids as your scanner. They are measured with the
scanimate.c tool which is in experimental SANE CVS. In the modes which
result in below 20 lines/s I also get backtracking.

Checking scan speed of device gt68xx:libusb:004:003 (Mustek Bearpaw 1200 CU Plus flatbed scanner)
mode:    Color, depth:  8, dpi:   50, KB:      246 (100%), secs:   4, KB/s:     61, lines/s:   49, mm/s:   25.0
mode:    Color, depth:  8, dpi:   75, KB:      553 (100%), secs:  11, KB/s:     50, lines/s:   26, mm/s:    9.1
mode:    Color, depth:  8, dpi:  150, KB:     2217 (100%), secs:  10, KB/s:    221, lines/s:   59, mm/s:   10.0
mode:    Color, depth:  8, dpi:  300, KB:     8867 (100%), secs:  21, KB/s:    422, lines/s:   56, mm/s:    4.8
mode:    Color, depth:  8, dpi:  600, KB:    35471 (100%), secs:  42, KB/s:    844, lines/s:   56, mm/s:    2.4
mode:    Color, depth:  8, dpi: 1200, KB:   100352 ( 70%), secs:  60, KB/s:   1672, lines/s:   55, mm/s:    1.2
mode:    Color, depth: 12, dpi:   50, KB:      492 (100%), secs:   4, KB/s:    123, lines/s:   49, mm/s:   25.0
mode:    Color, depth: 12, dpi:   75, KB:     1107 (100%), secs:  11, KB/s:    100, lines/s:   26, mm/s:    9.1
mode:    Color, depth: 12, dpi:  150, KB:     4435 (100%), secs:  10, KB/s:    443, lines/s:   59, mm/s:   10.0
mode:    Color, depth: 12, dpi:  300, KB:    17735 (100%), secs:  21, KB/s:    844, lines/s:   56, mm/s:    4.8
mode:    Color, depth: 12, dpi:  600, KB:     3072 (  4%), secs:  65, KB/s:     47, lines/s:    1, mm/s:    0.1
mode:    Color, depth: 12, dpi: 1200, KB:   136704 ( 48%), secs:  60, KB/s:   2278, lines/s:   37, mm/s:    0.8
mode:    Color, depth: 16, dpi:   50, KB:      492 (100%), secs:   5, KB/s:     98, lines/s:   39, mm/s:   20.0
mode:    Color, depth: 16, dpi:   75, KB:     1107 (100%), secs:  11, KB/s:    100, lines/s:   26, mm/s:    9.1
mode:    Color, depth: 16, dpi:  150, KB:     4435 (100%), secs:  13, KB/s:    341, lines/s:   45, mm/s:    7.7
mode:    Color, depth: 16, dpi:  300, KB:    17735 (100%), secs:  26, KB/s:    682, lines/s:   45, mm/s:    3.8
mode:    Color, depth: 16, dpi:  600, KB:     1024 (  1%), secs:  65, KB/s:     15, lines/s:    0, mm/s:    0.0
mode:    Color, depth: 16, dpi: 1200, KB:    78848 ( 27%), secs:  60, KB/s:   1314, lines/s:   21, mm/s:    0.5
mode:     Gray, depth:  8, dpi:   50, KB:       82 (100%), secs:   5, KB/s:     16, lines/s:   39, mm/s:   20.0
mode:     Gray, depth:  8, dpi:   75, KB:      184 (100%), secs:   4, KB/s:     46, lines/s:   73, mm/s:   25.0
mode:     Gray, depth:  8, dpi:  150, KB:      739 (100%), secs:   5, KB/s:    147, lines/s:  118, mm/s:   20.0
mode:     Gray, depth:  8, dpi:  300, KB:     2955 (100%), secs:  21, KB/s:    140, lines/s:   56, mm/s:    4.8
mode:     Gray, depth:  8, dpi:  600, KB:    11823 (100%), secs:  48, KB/s:    246, lines/s:   49, mm/s:    2.1
mode:     Gray, depth:  8, dpi: 1200, KB:    47295 (100%), secs:  34, KB/s:   1391, lines/s:  138, mm/s:    2.9
mode:     Gray, depth: 12, dpi:   50, KB:      164 (100%), secs:   5, KB/s:     32, lines/s:   39, mm/s:   20.0
mode:     Gray, depth: 12, dpi:   75, KB:      369 (100%), secs:   4, KB/s:     92, lines/s:   73, mm/s:   25.0
mode:     Gray, depth: 12, dpi:  150, KB:     1478 (100%), secs:   5, KB/s:    295, lines/s:  118, mm/s:   20.0
mode:     Gray, depth: 12, dpi:  300, KB:     5911 (100%), secs:  22, KB/s:    268, lines/s:   53, mm/s:    4.5
mode:     Gray, depth: 12, dpi:  600, KB:     8192 ( 34%), secs:  60, KB/s:    136, lines/s:   13, mm/s:    0.6
mode:     Gray, depth: 12, dpi: 1200, KB:    94590 (100%), secs:  43, KB/s:   2199, lines/s:  109, mm/s:    2.3
mode:     Gray, depth: 16, dpi:   50, KB:      164 (100%), secs:   5, KB/s:     32, lines/s:   39, mm/s:   20.0
mode:     Gray, depth: 16, dpi:   75, KB:      369 (100%), secs:   4, KB/s:     92, lines/s:   73, mm/s:   25.0
mode:     Gray, depth: 16, dpi:  150, KB:     1478 (100%), secs:   5, KB/s:    295, lines/s:  118, mm/s:   20.0
mode:     Gray, depth: 16, dpi:  300, KB:     5911 (100%), secs:  21, KB/s:    281, lines/s:   56, mm/s:    4.8
mode:     Gray, depth: 16, dpi:  600, KB:     1024 (  4%), secs:  97, KB/s:     10, lines/s:    1, mm/s:    0.0
mode:     Gray, depth: 16, dpi: 1200, KB:    22528 ( 23%), secs:  60, KB/s:    375, lines/s:   18, mm/s:    0.4
mode:  Lineart, dpi:   50, KB:       10 (100%), secs:   5, KB/s: 2, lines/s:   39, mm/s:   20.0
mode:  Lineart, dpi:   75, KB:       23 (100%), secs:   5, KB/s: 4, lines/s:   59, mm/s:   20.0
mode:  Lineart, dpi:  150, KB:       92 (100%), secs:   5, KB/s: 18, lines/s:  118, mm/s:   20.0
mode:  Lineart, dpi:  300, KB:      369 (100%), secs:  21, KB/s: 17, lines/s:   56, mm/s:    4.8
mode:  Lineart, dpi:  600, KB:     1476 (100%), secs:  48, KB/s: 30, lines/s:   49, mm/s:    2.1
mode:  Lineart, dpi: 1200, KB:     5905 (100%), secs:  33, KB/s: 178, lines/s:  143, mm/s:    3.0

Bye,
  Henning



More information about the sane-devel mailing list