[sane-devel] sane to work with USB 3.0
Olaf Meeuwissen
olaf.meeuwissen at avasys.jp
Thu Dec 11 07:21:31 UTC 2014
m. allan noah writes:
> I have just pushed your patches to git. They don't seem to help with
> any scanner that I have, but I doubt they will hurt anything.
Thanks!
> It appears that we also have USB3 issues with Canon scanners as well-
> they do use clear_halt frequently, and it seems that maybe the Linux
> kernel is not passing them down to the scanner in some cases.
Do they halt/stall that frequently? If there's no stall, clear_halt
should not be used, IIUC. Hmm, it doesn't look like sanei_usb allows
you to find out about that ...
> allan
>
> On Wed, Dec 10, 2014 at 6:55 PM, Olaf Meeuwissen
> <olaf.meeuwissen at avasys.jp> wrote:
>> Hi Allan,
>>
>> m. allan noah writes:
>>
>>> Your patch makes no difference for the Fujitsu models in question.
>>> I'll commit the patch in the next couple days, after some more
>>> testing.
>>
>> Any progress on this?
>>
>>> allan
>>>
>>> On Mon, Dec 1, 2014 at 9:44 PM, m. allan noah <kitno455 at gmail.com> wrote:
>>>> Ha! As we speak, I am digging into USB3 again, because command
>>>> counting seems to not fix every case. I will try your patch and report
>>>> back.
>>>>
>>>> allan
>>>>
>>>> On Mon, Dec 1, 2014 at 9:21 PM, Olaf Meeuwissen
>>>> <olaf.meeuwissen at avasys.jp> wrote:
>>>>> 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
--
Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962 Help support software freedom
http://www.fsf.org/jf?referrer=1962
More information about the sane-devel
mailing list