On Tue, Dec 29, 2020 at 03:03:06PM +0100, Marcus Glocker wrote:
> On Mon, 28 Dec 2020 20:55:33 +0000
> [email protected] wrote:
...
> > >Fix:  
> >     Per email threads on tech@ from above marc.info links below is
> > not proper solution, but a workaround:
> > 
> > --8<--
> > Index: dev/usb/ugen.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/usb/ugen.c,v
> > retrieving revision 1.109
> > diff -u -p -u -r1.109 ugen.c
> > --- dev/usb/ugen.c  25 Dec 2020 12:59:52 -0000      1.109
> > +++ dev/usb/ugen.c  27 Dec 2020 22:38:59 -0000
> > @@ -441,6 +442,7 @@ ugen_do_close(struct ugen_softc *sc, int
> >             DPRINTFN(5, ("ugenclose: endpt=%d dir=%d sce=%p\n",
> >                          endpt, dir, sce));
> >  
> > +           usbd_clear_endpoint_stall(sce->pipeh);
> >     /* MMM */ usbd_close_pipe(sce->pipeh);
> >             sce->pipeh = NULL;
> >  
> > -->8--  
> > 
> > It makes my scanner work reliably. There is still a second problem
> > metioned by me in https://marc.info/?t=160672895400002&r=1&w=2 but
> > that's different issue.
> > 
> > However my question would be, any idea how to proceed from where I am
> > at the moment? Any clues?
> > 
> > I've also CC'ed Natasha as she may be interested in this thread, as
> > she was the one who started email threads from above marc.info URLs.
> 
> I'll try to reproduce this issue here, but at the moment scanimage
> doesn't like my EPSON ET-2750 too much ...

Maybe you are facing what I'm seeing on my end (separete issue to
this one reported in this email thread), is that timeout is a bit too
low in sane-backends for my scanner. By default sane-backends has
1000ms timeout, but I see that about 3000ms for my scanner works
better.

With default 1 second timeout scanimage would fail a lot with following
error:

        scanimage: sane_read: Error during device I/O

Below diff is for sane-backends port, which I'm using for testing and I
specify `export SANE_CUSTOM_LIBUSB_TIMEOUT=3000` before starting
scanimage, to set 3 seconds timeout.

Not sure are you having same issue, maybe it will help you.

diff --git sanei/sanei_usb.c sanei/sanei_usb.c
index ae4f9b5c3..e5c574c13 100644
--- sanei/sanei_usb.c
+++ sanei/sanei_usb.c
@@ -3077,7 +3077,25 @@ sanei_usb_set_timeout (SANE_Int __sane_unused__ timeout)
     return;
 
 #if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
-  libusb_timeout = timeout;
+  char *env;
+  int number;
+
+  env = getenv ("SANE_CUSTOM_LIBUSB_TIMEOUT");
+  if (env) {
+    number = atoi(env);
+    if (number < 100) {
+      number = 100;
+    }
+    else if (number > 600000) {
+      number = 600000;
+    }
+    DBG (1, "%s() SANE_CUSTOM_LIBUSB_TIMEOUT=%d [%s:%d]\n", __func__, number, 
__FILE_NAME__, __LINE__);
+    libusb_timeout = number;
+  }
+  else {
+    libusb_timeout = timeout;
+  }
+  DBG (1, "%s() libusb_timeout=%d [%s:%d]\n", __func__, libusb_timeout, 
__FILE_NAME__, __LINE__);
 #else
   DBG (1, "sanei_usb_set_timeout: libusb support missing\n");
 #endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */


-- 
Regards,
 Mikolaj

Reply via email to