[sane-devel] Fujitsu USB timeout issues
m. allan noah
anoah at pfeiffer.edu
Thu Nov 13 17:48:45 GMT 2003
There are several folks on this list (and cc'd) who have Fujitsu scanners.
Most are SCSI, some are SCSI/USB models. Those trying to use their USB
ports under linux have been seeing strange timeouts, for as long as usb
support has been in the fujitsu backend.
I think i might have found something that could fix the timeout issues,
though i am hard-pressed to believe it is the best solution. It seems that
the USB Fujitsu models we support will fail to function on subsequent
requests, if the current scan does not use an EVEN number of commands
before sane_close().
I have tried this on a handful of linux 2.4 boxes, but all are using intel
or via UHCI, which is not enough testing for me to commit this to cvs just
before a SANE release...
so, could you guys apply this patch to fujitsu.c of the current cvs
snapshot, re-build and re-install sane, and let me know if this fixes the
issue for you? I am especially interested in OHCI/EHCI controllers, and
maybe a BSD instead of linux?
thanks for your patience guys,
allan
diff -c -r1.18 fujitsu.c
*** backend/fujitsu.c 7 Nov 2003 10:05:35 -0000 1.18
--- backend/fujitsu.c 13 Nov 2003 15:37:52 -0000
***************
*** 360,365 ****
--- 360,368 ----
/* Also set via config file. */
static int scsiBuffer = 64 * 1024;
+ /* flaming hack to get USB scanners
+ working without timeouts under linux */
+ static unsigned int cmd_count = 0;
/*
* required for compressed data transfer. sense_handler has to tell
***************
*** 3024,3029 ****
--- 3027,3034 ----
retry:
hexdump (IO_CMD, "<cmd<", cmd, cmd_len);
+ cmd_count++;
+
if (cmd_len > 0) op_code = ((int)cmd[0]) & 0xff;
if ((cmd_len+USB_CMD_HEADER_BYTES) > (int)sizeof(buf)) {
***************
*** 3251,3256 ****
--- 3256,3270 ----
release_unitB.size, NULL, 0, NULL);
if (ret)
return ret;
+
+ /* flaming hack cause some usb scanners (fi-4x20) fail
+ to work properly on next connection if an odd number
+ of commands are sent to the scanner. */
+ if(s->connection == SANE_FUJITSU_USB && cmd_count % 2){
+ ret = get_hardware_status(s);
+ if (ret)
+ return ret;
+ }
DBG (10, "free_scanner: ok\n");
return ret;
--
"so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls" - Max Cavalera
More information about the sane-devel
mailing list