[sane-devel] [PATCH] Fix IO error in pixma_wait_interrupt

Daniel Beer dlbeer at gmail.com
Wed May 2 20:55:59 UTC 2012


I tested commit c4a287e3f28eab0ceb0ef8f0a1d17cb724ad612f with a Canon
MP280 (Linux 2.6.38.5, libusb-0.1.12). scanimage -T failed with an IO
error, which I traced to pixma_wait_interrupt().

This function calls sanei_usb_read_int(). If no data is received, it
returns SANE_STATUS_EOF, which maps to PIXMA_EOF, which is in turn
treated as a fatal error in the calling function.

With the following patch, the MP280 works pretty well. Occasionally an
IO error occurs if you try to scan immediately after power-on
("warming up"?), but it always works on a retry.

---
 backend/pixma_io_sanei.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/backend/pixma_io_sanei.c b/backend/pixma_io_sanei.c
index 0a79bfa..06a6d0f 100644
--- a/backend/pixma_io_sanei.c
+++ b/backend/pixma_io_sanei.c
@@ -567,7 +567,8 @@ pixma_wait_interrupt (pixma_io_t * io, void *buf, unsigned size, int timeout)
 #endif
       error = map_error (sanei_usb_read_int (io->dev, buf, &count));
     }
-  if (error == PIXMA_EIO)
+  if (error == PIXMA_EIO ||
+      (io->interface == INT_USB && error == PIXMA_EOF))
     error = PIXMA_ETIMEDOUT;	/* FIXME: SANE doesn't have ETIMEDOUT!! */
   if (error == 0)
     error = count;
-- 
1.7.2.5




More information about the sane-devel mailing list