[sane-devel] sane to work with USB 3.0

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Tue Dec 2 02:21:39 UTC 2014


Olaf Meeuwissen writes:

> m. allan noah writes:
>
>> I have added a USB3 port to my computer, and have spent a few days
>> investigating this problem.
>
> I haven't had that kind of time, yet :-(

Finally got time to do so.
# Someone managed to sky-rocket the priority of USB3 support to the top
# of my TODO list ;-)

>> It seems to be a bug in Linux kernel related to a bookkeeping error
>> when the USB device is closed.  [...]

Based on two days of looking at USB3 behaviour with three EPSON scanners
and three backends, that does not seem to be the whole story.

>> I have committed these changes to sane-backends git repo in
>> 7a590f362e7e93979b706dd9e6ae34584e926ec3. If users of fujitsu scanners
>> could try it out, I would appreciate any feedback. Note that this does
>> not fix USB3 problems in other sane backends. Until the kernel is
>> fixed, these types of repairs will have to be made on a per-backend
>> basis, at the discretion of the maintainer.

The epson and epson2 backends have been and still are using the kind of
command counting and making sure to send an even count of reads and
writes you added to the fujitsu backend.  That notwithstanding, they
suffer from USB3 I/O problems with the Perfection V700 (GT-X900) and
ES-H300 (GT-2500).  The epkowa backend does *not* even up the reads and
writes and unsurprisingly shows the same problems.  In addition, the
GT-D1000 (GT-1500), a non-free plugin needing device, is also affected.

Making the epkowa backend even up the reads and writes did *not* fix the
problem.  What did fix the problem for all three scanners and all three
backends for me was a tiny change in sanei_usb.c.  With that change, the
evening up of reads and writes was not needed either.

The sanei_usb.c code unconditionally sets the USB configuration.  This
happens even if the device has only one.  I found that *not* setting the
USB configuration when there is only one fixed all my USB3 problems.  My
understanding of the USB2 and USB3 standards is that the default USB
configuration has to be set before devices become available to libusb.
If that understanding is correct, then there is no need to set it unless
you need a configuration that *differs* from the current one.  With only
one configuration to choose from, there is then no need to set it.

This patch does exactly that.  It skips setting the USB configuration if
there is only one.  It should not break USB for any of the backends and
*may* fix USB3 for all of them.

Note: it may still set the default configuration if there are multiple
      ones to choose from.  I have no devices I can test with to see if
      that is problematic or not.  Even so, modifying the code to only
      set a USB configuration if it differs should be safe.
      # Patch is in preparation.

Allan, can you locally revert your fujitsu fixes and try with the patch
I applied?  Does that fix your USB3 issues?  Do you still need to even
up the reads and writes?

Unless it breaks things for you, could you please commit my patch?
# Even if it does not fix USB3 for you.

Other people with USB3 issues are of course more than welcome to try
this patch too!

> [...]

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom
                 http://www.fsf.org/jf?referrer=1962
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Set-USB-configuration-only-if-there-are-alternative-.patch
Type: text/x-diff
Size: 5583 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20141202/32563c17/attachment.patch>


More information about the sane-devel mailing list