[sane-devel] Timeouts: usb_reset seems necessary to avoid bulk timeouts.

Olaf Meeuwissen olaf@epkowa.co.jp
Thu, 10 Jun 2004 13:02:21 +0900

Hi Tom,

I am the lead developer of iscan and the sane-epkowa backend that
comes with it.  Farideh has also contacted me about your issue, but I
think that my reply is better sent to sane-devel (at least it'll be
archived :-).

Tom Schutzer-Weissmann <misc@tomweissmann.org> writes:

> I had problems using the Epkowa libraries (libsane-epkowa) and the
> iscan frontend with my usb scanner in kernel 2.6.
> The scanner was closed after each operation. Once closed, nothing
> could be read from it, and I got lots of BULK TIMEOUTs, although there
> were no errors when the device was reopened.

Sorry to say, but I can't reproduce your problem.  I've tried with a
GT-8200 (aka Perfection 1650) on SuSE 9.1 and Debian (testing).  FWIW,
the version of relevant packages:

                            SuSE                  Debian
  iscan                     1.8.1-0.redhat.8.0    1.8.1-0.redhat.8.0
  sane                      1.0.13-73             --
  libsane                   --                    1.0.14-2
  libusb                    0.1.8-31              --
  libusb-0.1-4              --                    0.1.8-11
  kernel-default            2.6.4-52              --
  kernel-image-2.6.6-1-686  --                    2.6.6-1

with the note that I compiled iscan from sources on Debian.

Can you give more information about your setup?  Things like scanner
and distribution used as well as version of relevant software might
help me in reproducing your problem.

When you say that "Once closed, nothing could be read ...", do you
mean the calls to sanei_usb_close?  I've looked at the debugging USB
output and don't see any bulk timeouts.  My system logs also show

> By modifying the code so that usb_reset() was always called before
> usb_release_interface() and usb_close(), I solved the problem.

The epkowa backend does not call the usb_* functions directly, so I
presume you have been mucking around in sanei_usb, right?  This would
seem to indicate that you think the problem is not specific to the
epkowa backend.  I see below that you also get BULK TIMEOUTs with the
epson backend.  Both backends share a lot of code, so this is not an
indication that your problem is not backend specific.

Has anyone seen this with other backends?

> For libusb developers, my question is, should this be the case? There
> is nothing in the API docs to indicate that it's necessary - perhaps
> it is self-evident?
> Farideh - in the belief that you are a point of contact for Epson
> developers - could you make them aware of this issue, if they aren't
> already.

I read sane-devel ;-)

> I think this is relevant to SANE because although I had some success
> scanning with xsane and xscanimage, using the libsane-epson libraries,
> I still got timeouts if I closed, say, xsane, and then restarted it -
> for lack of a usb_reset() I believe.

I have no problems closing iscan and restarting it (for the setups
listed above).

> Apologies if this is old news.  Tom SW

Hope this helps,
Olaf Meeuwissen                            EPSON KOWA Corporation, PF1
FSF Associate Member #1962           sign up at http://member.fsf.org/
GnuPG key: 6BE37D90/AB6B 0D1F 99E7 1BF5 EB97  976A 16C7 F27D 6BE3 7D90
Penguin's lib!       -- I hack, therefore I am --               LPIC-2