Bug 955079 - sane-backends: USB scanner no longer found reilably (about every 2nd "scanimage -L" fails)
sane-backends: USB scanner no longer found reilably (about every 2nd "scanima...
Status: VERIFIED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other
Current
x86-64 SUSE Other
: P3 - Medium : Normal (vote)
: ---
Assigned To: Johannes Meixner
E-mail List
http://lists.alioth.debian.org/piperm...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-15 13:17 UTC by Olaf Hering
Modified: 2019-05-07 16:34 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Hering 2015-11-15 13:17:18 UTC
With some of the November TW snapshots (or with kernel 4.3) my USB scanner is not found anymore. I'm sure it worked on October and earlier.

Today I did some testing and scanimage -L finds it sometimes. Looks like every second attempt fails.

root@probook: # Nov 15 14:07:46 probook kernel: usb 4-3: USB disconnect, device number 2 
Nov 15 14:07:50 probook kernel: usb 4-3: new full-speed USB device number 3 using ohci-pci
Nov 15 14:07:50 probook kernel: usb 4-3: New USB device found, idVendor=06bd, idProduct=2061
Nov 15 14:07:50 probook kernel: usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 15 14:07:50 probook kernel: usb 4-3: Product: SNAPSCAN
Nov 15 14:07:50 probook kernel: usb 4-3: Manufacturer: AGFA 

root@probook: # scanimage -L
device `snapscan:libusb:004:003' is a AGFA SNAPSCAN flatbed scanner
root@probook: # scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
root@probook: # scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
root@probook: # 
root@probook: # Nov 15 14:15:38 probook kernel: usb 4-3: USB disconnect, device number 3
Nov 15 14:15:41 probook kernel: usb 4-3: new full-speed USB device number 4 using ohci-pci
Nov 15 14:15:41 probook kernel: usb 4-3: New USB device found, idVendor=06bd, idProduct=2061
Nov 15 14:15:41 probook kernel: usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 15 14:15:41 probook kernel: usb 4-3: Product: SNAPSCAN
Nov 15 14:15:41 probook kernel: usb 4-3: Manufacturer: AGFA 
scanimage -L
device `snapscan:libusb:004:004' is a AGFA SNAPSCAN flatbed scanner
root@probook: # scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
root@probook: #
Comment 1 Olaf Hering 2015-11-15 13:26:38 UTC
Kernel 4.2.4 does not work any better now. So its likely a regression in userland.
Comment 2 Johannes Meixner 2015-11-16 09:22:18 UTC
The issue is not caused by openSUSE patches for sane-backends
(because there are no such patches for sane-backends).

When the root cause is in sane-backends then it is
a SANE upstrem issue which you already reported in your
"regression in sane-backends 1.0.25, AGFA Snapscan 1212U_2 not found"
mail thread at sane-devel@lists.alioth.debian.org

But the root cause could also be in the kernel or in libusb.

When your scanner is connected at a USB port where
the kernel module xhci_hcd is used (see "lsusb -t")
then it is likey a duplicate of bug#856794.

Details:

In general "sometimes works / sometimes fails" indicates that the
root cause is somehow hardware related where "hardware" means
the actual computer hardware plus the computer's built-in
firmware (i.e. BIOS or UEFI) and "hardware related" means
computer hardware plus firmware plus Linux kernel driver
plus low-level hardware related software (e.g. libusb).

There are currently issues with scanners at USB ports
when the kernel module "xhci" is used as kernel driver.

When "lsusb -t" shows "Driver=xhci_hcd" for the USB bus and port
where the USB scanner is connected (see "lsusb" where the scanner
is connected), then there could be issues depending on the
computer hardware and firmware.

In this case see
https://bugzilla.opensuse.org/show_bug.cgi?id=856794
in particular see
https://bugzilla.opensuse.org/show_bug.cgi?id=856794#c24
that reads (excerpt):
-----------------------------------------------------------------
My machine has 4 USB ports, two labeled with
the "super speed" USB logo (a.k.a. USB 3) and
two labeled with the normal USB logo (a.k.a. USB 2)
but for all 4 ports xhci is used and it fails on all 4 ports.
-----------------------------------------------------------------
and see
https://bugzilla.opensuse.org/show_bug.cgi?id=856794#c40
that reads (excerpt):
-----------------------------------------------------------------
It depends on the computer hardware where "hardware"
includes the computer's firmware (BIOS or UEFI).
There are computers where USB3 always "just works".
There are computers where USB3 fails under certain conditions.
Perhaps there are computers where USB3 always fails.
-----------------------------------------------------------------

When your scanner is not connected at a USB port where the
kernel module xhci_hcd is used as kernel driver (e.g. when
your scanner is connected at a USB port where the kernel
module uhci_hcd or ehci_hcd is used as kernel driver),
then have a look at "Trouble-Shooting (Debugging)" in
https://en.opensuse.org/SDB:Configuring_Scanners

For example to get USB debugging information
you could use comands (as root) like
-----------------------------------------------------------------
export SANE_DEBUG_SANEI_USB=128
scanimage -L
unset SANE_DEBUG_SANEI_USB
-----------------------------------------------------------------
Comment 3 Johannes Meixner 2015-11-16 09:31:22 UTC
I overlooked "using ohci-pci" in your initial comment#0.

Only a blind guess - I am not at all a USB expert - perhaps
the workarounds for USB3 in sane-backends do not work well
with USB ports where "ohci" is used?
Comment 4 Roger Whittaker 2017-05-16 11:35:34 UTC
I have the same problem as described here, with the same scanner.

The hardware is an Intel NUC - if I disable xhci in the EFI BIOS, I see:

 # lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/8p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
        |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
            |__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=, 12M
            |__ Port 4: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=uas, 480M
        |__ Port 4: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 4: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

# lsusb
Bus 001 Device 006: ID 1a81:1004 Holtek Semiconductor, Inc. 
Bus 001 Device 004: ID 0bc2:ab26 Seagate RSS LLC 
Bus 001 Device 007: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 001 Device 008: ID 06bd:2061 AGFA-Gevaert NV SnapScan 1212U (?)
Bus 001 Device 005: ID 0cf2:6230 ENE Technology, Inc. SD Card Reader (UB623X)
Bus 001 Device 003: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But the behaviour is the same as when xhci is enabled (and as described above).

Is this something that could one day be fixed with changes in the Linux USB drivers, or is it ultimately just a hardware incompatibility?

And is there any mileage in trying to change the behaviour with setpci commands as I've seen suggested elsewhere?
Comment 5 Roger Whittaker 2017-05-16 14:23:50 UTC
I should have mentioned that I am using latest Tumbleweed.

$ cat /etc/os-release
NAME="openSUSE Tumbleweed"
# VERSION="20170510"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="20170510"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20170510"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

$ uname -r
4.10.13-1-default
Comment 6 Roger Whittaker 2017-05-16 16:28:17 UTC
Update - after speaking to Olaf Hering, I have installed his sane-backends package from

http://download.opensuse.org/repositories/home:/olh/openSUSE_Tumbleweed/x86_64/sane-backends-1.0.24-4.olh.239.x86_64.rpm

This does not contain the issue that was apparently introduced in 1.0.25, and works well for me provided that I disable xhci in the BIOS.
Comment 7 Johannes Meixner 2017-05-29 08:38:56 UTC
FYI:
sane-backends-1.0.27 RPM packages for openSUSE users
are now available in the openSUSE Build Service
development project "graphics" for manual download
for openSUSE Leap and openSUSE Tumbleweed from
http://download.opensuse.org/repositories/graphics/

In general see the section
"RPM packages of the 'sane-backends' scanner drivers"
at https://en.opensuse.org/SDB:Configuring_Scanners

The sane-backends version 1.0.27 release contains
in particular this change regarding USB3
for details see http://www.sane-project.org/
-----------------------------------------------------------------
 * Updated Linux USB3 workaround (see Note 3).
...
Note 3: The Linux USB3 workaround which was added
in version 1.0.25 is now disabled by default.
If you have difficulty using a scanner which previously worked,
or intermittent scanner availability, try setting the new
environment variable SANE_USB_WORKAROUND=1
before starting your frontend. 
-----------------------------------------------------------------

I assume the issue is fixed in sane-backends version 1.0.27.
Comment 8 Olaf Hering 2017-07-24 21:34:43 UTC
The update did not fix this scanner.

Guess at some point I have to bisect it.
Comment 9 Olaf Hering 2019-05-07 16:34:25 UTC
Luckily it happens to work in current Tumbleweed and also in Leap 15.0.