Benq Scanner 5000 works from time to time

Hi all!

I use:
Benq Scanner 5000
sane-backends-1.0.21
FreeBSD 7.4-STABLE
Code:
firmware /home/user/ftp/20F8V119.bin
in snapscan.conf

The problem is the scanner works unstable (from time to time). It takes multiple attempts of [cmd=]scanimage > file.ppm[/cmd] to get the scan. Only lsusb can always see the scanner while sane-find-scanner and scanimage -L can see it from time to time.

I've tried changing firmware to 20F8V116.bin, 20F8V114.bin, 20F8V112.bin - the problem repeats. The scanner works fine under Windows 7 and Linux (Slax 6.1.2 LiveCD, sane 1.0.20), so the hardware is ok, probably it is an OS-related problem. In sane's [sane-devel] mailing list I got the recommendation to ask on some FreeBSD forums.

All my actions have been tested in 2 cases:

1. with libusb (kernel without 'device uscanner')
2. with uscanner:
[cmd=]echo 'product ACERP ACERSCAN_5000 0x20f8 Benq 5000' >> /usr/src/sys/dev/usb/usbdevs[/cmd]
[cmd=]echo '{{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_5000 }, 0 },' >> /usr/src/sys/dev/usb/uscanner.c[/cmd]
recompiled kernel with 'device uscanner'.

Case 1:
Benq 5000 powered on first time:

# lsusb
Code:
Bus /dev/usb2 Device /dev/ugen0: ID 04a5:20f8 Acer Peripherals Inc. (now BenQ Corp.) Benq 5000

sane-find-scanner found the scanner on the fourth attempt:

# sane-find-scanner -q
# sane-find-scanner -q
# sane-find-scanner -q
# sane-find-scanner -q
Code:
found USB scanner (vendor=0x04a5 [Color], product=0x20f8 [ FlatbedScanner 22]) at libusb:/dev/usb2:/dev/ugen0

and scanimage found it on the third attempt:

# scanimage -L

Code:
No scanners were identified. ....
.
.
.
# scanimage -L
Code:
device `snapscan:libusb:/dev/usb2:/dev/ugen0' is a Acer FlatbedScanner42 flatbed scanner

After 6 attempts of:
# scanimage --quality-cal=no > image-7.ppm
Code:
scanimage: no SANE devices found

We got the scan:
# scanimage --quality-cal=no > image-7.ppm
Code:
#

and next:
# scanimage -L

Code:
No scanners were identified.....

And I have to wait several minutes getting these errors to get the next scan.

Case 2:

Benq 5000 powered on first time it is found by sane-find-scanner and scanimage successfully:

# sane-find-scanner -q
Code:
found USB scanner (vendor=0x04a5, product=0x20f8) at /dev/uscanner0

# scanimage -L
Code:
device `snapscan:/dev/uscanner0' is a Acer FlatbedScanner22 flatbed scanner

# scanimage --quality-cal=no > image-1.ppm
Code:
[snapscan] Scanner warming up - waiting 31 seconds.
#
OK. We got the scan.

After 3 minutes:

# scanimage --quality-cal=no > image-2.ppm

hangs forever...

If I kill scanimage and use sane-find-scanner:
# sane-find-scanner -q
# sane-find-scanner -q

I have nothing.

I would be very grateful if anybody points me to the root of this instability. Thanks for your time!

--
Oleg
 
Have you tried with debug output? Like this:
Code:
SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
Warning, there will be lots of output, but perhaps you will be able to find out what's happening when it does not work.
 
This is debug info I've got in Case 1 (with libusb):

# scanimage -v -v -L

Code:
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(/dev/usbscanner bus=usb)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(/dev/usbscanner)
[snapscan] add_usb_device: error opening device /dev/usbscanner: Invalid argument
[snapscan] add_usb_device(libusb:/dev/usb2:/dev/ugen0)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb2:/dev/ugen0)
[snapscan] add_usb_device: Checking if 0x04a5 is a supported USB vendor ID
[snapscan] snapscani_check_device()
[snapscan] mini_inquiry
[snapscan] snapscan_cmd
[snapscan] snapscani_usb_cmd(0,0xbfbfdc92,6,0xbfbfdc6e,0xbfbfdc98 (36))
[snapscan] atomic_usb_cmd(0,0xbfbfdc92,6,0xbfbfdc6e,0xbfbfdc98 (36))
[snapscan] usb_cmd(0,0xbfbfdc92,6,0xbfbfdc6e,0xbfbfdc98 (36))
[snapscan] usb_cmd: cmdlen=6, datalen=0
[snapscan] usb_write: writing:  0x12 0x00 0x00 0x00 0x24 0x00
[snapscan] Written 6 bytes
[snapscan] usb_read: reading:  0xf9 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] usb_read: reading:  0x06 0x00 0x02 0x02 0x49 0x00 0x00 0x00 0x43 0x6f ...
[snapscan] Read 36 bytes
[snapscan] usb_read: reading:  0xfb 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] snapscani_check_device: Is vendor "Color" model "FlatbedScanner22" a supported scanner?
[snapscan] snapscani_get_model_id(FlatbedScanner22, 0, 2)
[snapscan] snapscani_get_model_id: looking up scanner for ID 0x04a5,0x20f8.
[snapscan] snapscani_check_device: Autodetected driver: Acer4300 (42 bit)
[snapscan] snapscani_usb_close(0)
[snapscan] 1st read 3 write 1
[snapscan] snapscani_usb_cmd(0,0xbfbfdcce,6,0x0,0x0 (0))
[snapscan] atomic_usb_cmd(0,0xbfbfdcce,6,0x0,0x0 (0))
[snapscan] usb_cmd(0,0xbfbfdcce,6,0x0,0x0 (0))
[snapscan] usb_cmd: cmdlen=6, datalen=0
[snapscan] usb_write: writing:  0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Written 6 bytes
[snapscan] usb_read: reading:  0xfb 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] 2nd read 4 write 2
[snapscan] snapscani_init_device_structure()
[snapscan] sane_snapscan_get_devices (0xbfbfe2a8, 0)
device `snapscan:libusb:/dev/usb2:/dev/ugen0' is a Acer FlatbedScanner22 flatbed scanner
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

The scanner is found. Next I've got the scan successfully:

# scanimage --quality-cal=no --resolution=100 > image20.ppm

And the scanner became invisible:

# scanimage -v -v -L
Code:
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(/dev/usbscanner bus=usb)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(/dev/usbscanner)
[snapscan] add_usb_device: error opening device /dev/usbscanner: Invalid argument
[snapscan] sane_snapscan_get_devices (0xbfbfe2a8, 0)

No scanners were identified. If you were expecting something different, 
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation 
which came with this software (README, FAQ, manpages).
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

visible...

# sane-find-scanner -q

Code:
found USB scanner (vendor=0x04a5 [Color], product=0x20f8 [ FlatbedScanner 22]) at libusb:/dev/usb2:/dev/ugen0

invisible...

# scanimage -v -v -L

Code:
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(/dev/usbscanner bus=usb)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(/dev/usbscanner)
[snapscan] add_usb_device: error opening device /dev/usbscanner: Invalid argument
[snapscan] sane_snapscan_get_devices (0xbfbfe288, 0)

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

And triple empty output of sane-find-scanner again:
# sane-find-scanner -q

I don't understand, why scanimage and sane-find-scanner cannot find libusb:/dev/usb2:/dev/ugen0 sometimes. Maybe it is libusb problem? Reinstalling it doesn't solve the problem.
 
Perhaps the scanner needs some time after being powered on (and after scanning) before it is ready?
From powered on, if you only use $ scanimage -L, is the scanner found every time then? Or only sometimes?
There is a way to turn on usb debugging, but I'm not certain what options you should use. Maybe you should ask about this problem on the freebsd-usb mailing list.
 
Back
Top