Bug 706877

Summary: Scanner doesn't access avision device with scanimage (Invalid argument)
Product: [Fedora] Fedora Reporter: Werner Gold <wgold>
Component: sane-backendsAssignee: Nils Philippsen <nphilipp>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: nphilipp
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: sane-backends-1.0.22-10.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-11 10:33:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace output none

Description Werner Gold 2011-05-23 10:39:10 UTC
Description of problem:

scanimage results in: Invalid Argument.

scanimage -L finds scanner, xsane works.

Strace:

open("/usr/lib64/sane/libsane-avision.so.1", O_RDONLY) = 3
close(3)                                = 0
futex(0x39854030e0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/usr/lib64/sane/libsane-avision.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220c\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=182656, ...}) = 0
mmap(NULL, 2287168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f724a09d000
mprotect(0x7f724a0c7000, 2097152, PROT_NONE) = 0
mmap(0x7f724a2c7000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2a000) = 0x7f724a2c7000
mmap(0x7f724a2ca000, 5696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f724a2ca000
close(3)                                = 0
write(2, "scanimage: open of device avisio"..., 74scanimage: open of device avision:libusb:002:082 failed: Invalid argument
) = 74

Version-Release number of selected component (if applicable):

 1.0.22-3.fc14

Downgrade to 1.0.21-3.fc14 removes error.

Comment 1 Werner Gold 2012-03-26 17:25:53 UTC
After migration to F16 1.0.21 is not supported anymore.
The problem remains.

[wgold@jerry ~]$ scanimage  -L
device `v4l:/dev/video0' is a Noname Integrated Camera virtual device
device `avision:libusb:001:032' is a Hewlett-Packard ScanJet 7400c flatbed scanner
default device is `avision:libusb:001:032'
[wgold@jerry ~]$ export SANE_DEFAULT_DEVICE='avision:libusb:001:032'
[wgold@jerry ~]$ scanimage  
scanimage: open of device avision:libusb:001:032 failed: Invalid argument
[wgold@jerry ~]$

Comment 2 Nils Philippsen 2012-03-28 08:08:53 UTC
Hi Werner, please enable debugging in the backend driver and run scanimage again, then attach the output to this ticket:

export SANE_DEFAULT_DEVICE='avision:libusb:001:032'
export SANE_DEBUG_AVISION=7
scanimage

Thanks!

Comment 3 Werner Gold 2012-03-29 09:35:57 UTC
Not much enlightening. :-(

[wgold@jerry tmp]$ scanimage 
[sanei_debug] Setting debug level of avision to 7.
[avision] sane_init:(Version: 1.0 Build: 294)
[avision] sane_open:
scanimage: open of device avision:libusb:001:045 failed: Invalid argument
[avision] sane_exit:

I'll add the strace output.

Comment 4 Werner Gold 2012-03-29 09:37:16 UTC
Created attachment 573603 [details]
strace output

Comment 5 Nils Philippsen 2012-04-17 09:42:22 UTC
The issue here is that the code to discover devices was moved out of the initialization routine sane_init() into its own function, but that function wasn't called in sane_init(). This bug was introduced in this commit...

commit 37b45c4f76a66f9cd2c3d4bd98dd371dfbda74e5
Author:     Mike Kelly <mike>
AuthorDate: Thu Dec 23 19:35:23 2010 +0900

    Moved device init code to sane_get_devices()
    
    Moved device init code from sane_init() to the newly created
    sane_reload_devices() function, which is now called from sane_get_devices().
    This means that device initialization now happens when sane_get_devices() is
    called, not when sane_init() is called.

...and subsequently fixed upstream in this one (after 1.0.22 was out):

commit 33bb529c5f8ca013fb499addc14c7fb229203ea8
Author:     Mike Kelly <mike>
AuthorDate: Wed Mar 21 21:03:00 2012 -0700

    Added sane_reload_devices() to sane_init().
    
    Adding sane_reload_devices() to sane_init() required sane_init() to be moved
    below the sane_reload_devices() declaration.  This restores the original
    functionality present before I split the sane_reload_devices() code out of
    sane_init() so that it could be called from sane_get_devices().

I'll build an update containing this fix shortly.

Comment 6 Fedora Update System 2012-04-17 10:34:33 UTC
sane-backends-1.0.22-10.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/sane-backends-1.0.22-10.fc17

Comment 7 Fedora Update System 2012-04-17 10:36:23 UTC
sane-backends-1.0.22-10.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/sane-backends-1.0.22-10.fc16

Comment 8 Fedora Update System 2012-04-17 10:37:34 UTC
sane-backends-1.0.22-10.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/sane-backends-1.0.22-10.fc15

Comment 9 Fedora Update System 2012-04-18 19:25:28 UTC
Package sane-backends-1.0.22-10.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing sane-backends-1.0.22-10.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-6004/sane-backends-1.0.22-10.fc16
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2012-04-27 05:59:35 UTC
sane-backends-1.0.22-10.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2012-05-11 10:33:12 UTC
sane-backends-1.0.22-10.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2012-05-26 22:23:52 UTC
sane-backends-1.0.22-10.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.