sjamesr / jfreesane

Java API to talk to the SANE scanning daemon
Apache License 2.0
60 stars 25 forks source link

Canon DR 1130 Issue #76

Open qamarhafeez opened 6 years ago

qamarhafeez commented 6 years ago

when scanning with Canon DRG1130 Model in adf model, after it finishes all pages sometime it hold me on wait and return STATUS_IO_ERROR and sometimes it didn't wait and return quickly STATUS_NO_DOCS. How can i debug this issue, please help

sjamesr commented 6 years ago

Are you able to try out a patch for me? It's just a hunch

diff --git a/src/main/java/au/com/southsky/jfreesane/SaneSession.java b/src/main/java/au/com/southsky/jfreesane/SaneSession.java
index b78438e..c6b7061 100644
--- a/src/main/java/au/com/southsky/jfreesane/SaneSession.java
+++ b/src/main/java/au/com/southsky/jfreesane/SaneSession.java
@@ -212,9 +212,9 @@ public final class SaneSession implements Closeable {
     SaneParameters parameters = null;
     listener.scanningStarted(device);
     int currentFrame = 0;
+    SaneDeviceHandle handle = device.getHandle();

     do {
-      SaneDeviceHandle handle = device.getHandle();
       outputStream.write(SaneRpcCode.SANE_NET_START);
       outputStream.write(handle.getHandle());
       outputStream.flush();
@@ -285,6 +285,7 @@ public final class SaneSession implements Closeable {
     } while (!parameters.isLastFrame());

     listener.scanningFinished(device);
+    cancelDevice(handle);
     SaneImage image = builder.build();
     return image.toBufferedImage();
   }
qamarhafeez commented 6 years ago

This patch is not the issue, After investing too many hours, i noticed that the scanner is having I/O Error with xhci usb 3.0 kernel driver. My PC has all usb 3 ports, and bios does not have option to disable 3.0 mode. How can i disable it in operating system?