[sane-devel] sm3600 backend problem

Mattias Ellert mattias.ellert@tsl.uu.se
Mon, 16 Feb 2004 01:04:32 +0100


Hi!

I have been trying to solve a problem for a user with a Microtek 3600 
scanner on a Mac. The first error log he sent me looked like a libusb 
problem, and after looking through the libusb code I was able patch 
libusb to handle a change of usb configuration without loosing the claim 
of the interface. (The patch has been added to the libusb support system 
at sourceforge).

http://sourceforge.net/tracker/index.php?func=detail&aid=897350&group_id=1674&atid=301674

With this fixed libusb library, it works better. It manages to claim the 
interface again after changing the configuration (this is where it 
failed without the patch):

usb_os_open: 05da:40b3
usb_claim_interface: called for interface 0
Interface 0 of device is 0x0
claim_interface: No interface found; selecting configuration
claim_interface: device has 1 configuration
claim_interface: configuration value is 1
claim_interface: Interface 0 of device is 0xf0b
claim_interface: Interface 0 of device from QueryInterface is 0x3049f0
usb_set_configuration: called for config 1
Interface 0 of device is 0xe9b
claim_interface: Interface 0 of device from QueryInterface is 0x304ae0

Then the following is repeated several times:

usb_bulk_read: ep addr = 0x82
Converting ep address to pipeRef.
ep_to_pipeRef: Pipe 1: DIR: 1 number: 2
ep_to_pipeRef: pipeRef for ep address 0x82 found: 0x01
usb_bulk_read: endpoint=0x82 size=4096 timeout=2000 ms
read/write completed, result=0, size=4096
usb_bulk_read: ep addr = 0x82
Converting ep address to pipeRef.
ep_to_pipeRef: Pipe 1: DIR: 1 number: 2
ep_to_pipeRef: pipeRef for ep address 0x82 found: 0x01
usb_bulk_read: endpoint=0x82 size=1204 timeout=2000 ms
read/write completed, result=0, size=1204

with some lt1=n, lt2=n between them until it finally says lt3=0.

Then it repeats the above sequence 8 times more without any lt[1,2,3]=n 
statements.

This is (if I understand the backend code correctly) the scanner first 
positioning the scanner for the calibration and then doing the 
calibration step. Looking at the code the calibration requires reading 
5300 bytes 8 times.

Then it fails with:

scanimage: sane_start: Error during device I/O
[sm3600] cancel called...
[sm3600] closing scanner
usb_os_close: 05da:40b3
[sm3600] Error status: 9, Timeout while waiting for CTL

The complete log (with SANE_DEBUG_SM3600=255 SANE_DEBUG_SANEI_USB=255) 
can be found at:

http://www.ellert.se/twain-sane/debug/sm3600.log

Grepping for fork in the sm3600* files does not give any match, so it 
(at least at first sight) doesn't look like a fork problem.

The code for the sm3600 backend is not very easy to follow, so I really 
could do with some more input here.

	Mattias

-- 
________________________________________________________________________

mattias.ellert@tsl.uu.se                           tel: +46 18 471 32 58
http://www.tsl.uu.se/~ellert/                      fax: +46 18 471 35 13
________________________________________________________________________