Detected scanner fails to load with "Invalid Argument"

Bug #24946 reported by rsay
46
This bug affects 5 people
Affects Status Importance Assigned to Milestone
sane-backends (Ubuntu)
Confirmed
Medium
Unassigned
xsane (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Since upgrading to Breezy, my scanner no longer works. It was performing fine in
Hoary. When I load xsane, I get an error message that says:
Failed to open device 'artec_eplus48u:libusb:003:003': Invalid argument.
Same results as root and user.

Other possibly pertinent info:

scanimage -L
device `artec_eplus48u:libusb:003:003' is a Artec E+ 48U USB flatbed scanner

scanimage -T
scanimage: open of device artec_eplus48u:libusb:003:003 failed: Invalid argument

uname -r
2.6.12-9-386

dmesg
Nov 2 22:55:39 aria kernel: [4295123.974000] usb 3-2: USB disconnect, address 2
Nov 2 22:55:45 aria kernel: [4295130.390000] usb 3-1: new full speed USB device
using uhci_hcd and address 3
Nov 2 22:55:45 aria usb.agent[8348]: libusbscanner: loaded successfully

lsusb| grep Artec
Bus 003 Device 003: ID 05d8:4003 Ultima Electronics Corp. Artec E+ 48U

lspci | grep USB
0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
Controller (rev 80)
0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
Controller (rev 80)
0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
Controller (rev 80)
0000:00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)

Revision history for this message
Matt Zimmerman (mdz) wrote :

If this is still happening to you, please run "strace -f scanimage -T"

Changed in xsane:
assignee: nobody → pitti
Changed in sane-backends:
status: Unconfirmed → Needs Info
Revision history for this message
Martin Pitt (pitti) wrote :

Can you please check this in Dapper? http://bugs.debian.org/342016 reported a similar issue (against xsane, though), which should now be fixed. Please try a live CD if you do not want to upgrade your system to dapper now. Thank you!

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

I could only get my Epson Perfection 4490 Photo scanner to work as root in Ubuntu 5.10 upgraded to Dapper Beta. So, to make sure it wasn't due to old baggage from 5.10, I just installed a fresh Dapper Beta from the 4/25/06 daily dvd and am having the same problem.

I have installed iscan 2.0.0-1 from the epkowa site (used alien to create .debs from the .rpms) along with the iscan-plugin-gt-x750_1.0.0-2_i386 package. These support this particular scanner. Both xsane and iscan work fine as sudo ...,
but not as a normal user.

gerry@dapper-gst:~$ sudo sane-find-scanner

found USB scanner (vendor=0x04b8 [EPSON], product=0x0119 [EPSON Scanner]) at libusb:007:002

I even changed the mode of /proc/bus/usb/007/002 with
chmod a+w.
gerry@dapper-gst:~$ ls -l /proc/bus/usb/007/002
-rw-rw-rw- 1 root root 50 2006-04-26 15:28 /proc/bus/usb/007/002

If as a normal user I
gerry@dapper-gst:~$ xsane &
I get an error dialog from xsane "no devices available". If I use sudo, xsane opens and the scanner works right.

If as a normal user I
gerry@dapper-gst:~$ iscan &
I get an error dialog from iscan "Could not send command to scanner. Check the scanner's status." If I use sudo, iscan runs just fine.

I have this same setup working just fine as a normal user in Fedora Core 5 and OpenSuse 10.1, so I know it should be working here also.

I tried to run strace -f scanimage -T > strace.out, but it spilled the output to the terminal window instead of the file strace.out. If you can tell me how to capture the output into a file, I'll be happy to provide it to you. By the way, I don't see how to attach such a file to this report. I'm familiar with RedHat bugzilla, but this is my first attempt to do a bug report here.

If I can do any other diagnostics, just let me know.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for checking again. The strace invocation should look like this:

  strace -o strace.out -f scanimage -T

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

Here is the terminal output when I did this. I had to do it sudo to succeed:
gerry@gst-ubuntu:~$ strace -o strace.out -f scanimage -T
scanimage: sane_start: Invalid argument
[1]+ Done xsane
gerry@gst-ubuntu:~$ sudo strace -o strace.out -f scanimage -T
Password:
scanimage: scanning image of size 2544x3509 pixels at 1 bits/pixel
scanimage: acquiring gray frame, 1 bits/sample
scanimage: reading one scanline, 318 bytes... PASS
scanimage: reading one byte... PASS
scanimage: stepped read, 2 bytes... PASS
scanimage: stepped read, 4 bytes... PASS
scanimage: stepped read, 8 bytes... PASS
scanimage: stepped read, 16 bytes... PASS
scanimage: stepped read, 32 bytes... PASS
scanimage: stepped read, 64 bytes... PASS
scanimage: stepped read, 128 bytes... PASS
scanimage: stepped read, 256 bytes... PASS
scanimage: stepped read, 512 bytes... PASS
scanimage: stepped read, 511 bytes... PASS
scanimage: stepped read, 255 bytes... PASS
scanimage: stepped read, 127 bytes... PASS
scanimage: stepped read, 63 bytes... PASS
scanimage: stepped read, 31 bytes... PASS
scanimage: stepped read, 15 bytes... PASS
scanimage: stepped read, 7 bytes... PASS
scanimage: stepped read, 3 bytes... PASS

It created a file
gerry@gst-ubuntu:~$ ls -l strace.out
-rw-r--r-- 1 gerry gerry 1348758 2006-05-08 07:24 strace.out

How do I attach that file to this report? I hesitate to paste it as it is very long. I don't see a way on this page to add an attachment.

Thanks. Gerry

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote : Attachment for last comment

Just after I sent the last comment, I saw the place to add the attachment. Duh!

Revision history for this message
Martin Pitt (pitti) wrote :

Can you please attach the strace for the case where it aborts with 'Invalid argument'? The strace for the succeeding case isn't very helpful in debugging. :) Thanks!

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote : strace output for strace -o stracexsane.out -f xsane

This is the result of running xsane as a user via strace. The xsane interface opens, but the scanner is not properly identified in the title bar and the result is a dialog that says "failed to start scanner: Invalid argument."

Running xsane as sudo works correctly.

Hope this one helps. Let me know of any further needs for testing.

This is after this morning's updates including the vmlinuz-2.6.15-22-k7 new kernel, followed by a reboot to use the new kernel.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for the strace. I think we come closer:

6224 open("/dev/bus/usb/008/002", O_RDWR) = -1 EACCES (Permission denied)
6224 open("/dev/bus/usb/008/002", O_RDONLY) = 7
6224 ioctl(7, USBDEVFS_CONNECTINFO, 0xbf97d594) = -1 EPERM (Operation not permitted)

When you plug in your scanner, a /dev/bus/x/y device is created. x and y can be found out with 'lsusb'. What are
the initial permissions of that device, i. e. can you please give the output of

  ls -l /dev/bus/usb/x/y

If you do

  sudo chmod g+w /dev/bus/usb/x/y

does it work then?

Revision history for this message
Martin Pitt (pitti) wrote :

Erm, please forget my previous request for the chmod. udev normally creates the files with 0664 permissions, i. e. world-readable and group-writable. Are you in the scanner group? If 'id' does not report that you are in 'scanner', please do

  sudo adduser gerry scanner

('gerry' is your login name; please use your actual username), log out, back in, and try again.

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

I am and have always been a member of the scanner group.
gerry@gst-ubuntu:~$ id
uid=500(gerry) gid=500(gerry) groups=4(adm),20(dialout),21(fax),24(cdrom),25(floppy),26(tape),29(audio),30(dip),44(video),46(plugdev),104(lpadmin),105(scanner),106(admin),500(gerry)

gerry@gst-ubuntu:~$ lsusb
Bus 008 Device 004: ID 0424:223a Standard Microsystems Corp. 8-in-1 Card Reader
Bus 008 Device 003: ID 0930:653d Toshiba Corp.
Bus 008 Device 002: ID 05e3:0605 Genesys Logic, Inc. USB 2.0 Hub [ednet]
Bus 008 Device 001: ID 0000:0000
Bus 007 Device 002: ID 04b8:0119 Seiko Epson Corp.

gerry@gst-ubuntu:~$ sudo sane-find-scanner

found USB scanner (vendor=0x04b8 [EPSON], product=0x0119 [EPSON Scanner]) at libusb:007:002

gerry@gst-ubuntu:~$ ls -l /dev/bus/usb/007/002
crw-rw-rw- 1 root scanner 189, 769 2006-05-10 10:44 /dev/bus/usb/007/002

Note that /dev/bus/usb/008/002 is a USB Hub, not ht scanner

gerry@gst-ubuntu:~$ ls -l /dev/bus/usb/008/002
crw-rw-r-- 1 root root 189, 897 2006-05-10 10:44 /dev/bus/usb/008/002

Note that this device is owned by user/group root. How can I tell if this is the device the scanner is plugged into? The scanner is plugged into an add-on PCI hub to get USB 2.0 performance instead of the on-mainboard USB 1.1 interface.

Recall that this same setup works fine in Fedora Core 5 and OpenSuse 10.1 RC1.

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

The problem keeping this from working must be very minor. When I execute 'xsane &' as a user, the xsane interface opens and the scanner lights actually flash like the scanner is being initialized. The legend in the title bar of the main xsane window says "xsane 0.97 4.1a:002" The problem shows up when I try to preview or scan. An Error box pops up with the message "Failed to start scanner: invalid argument."

If I execute 'sudo xsane' , everything works correctly and the xsane window title bar legend says "xsane 0.97 Perfection 4490:002."

Revision history for this message
Martin Pitt (pitti) wrote :

Ah, so the scanner is attached to an USB hub? I'm not sure whether this 'EPERM (Operation not permitted)' line from the strace is the cause or just an uninteresting side event. Can you please try whether it works after doing any of these steps:

 * sudo chmod 666 /dev/bus/usb/008/002
 * sudo chmod 660 /dev/bus/usb/008/002
 * attach the scanner to a different USB port and remove the USB hub

Thank you!

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

I confirmed that the scanner USB channels were still the same and then performed the three tests you suggested in the order listed. None of them caused the scanner to work as a user.

The scanner is now plugged into a mainboard USB port (USB 1.1), on 005:002.

gerry@gst-ubuntu:~$ lsusb
Bus 007 Device 001: ID 0000:0000
Bus 008 Device 004: ID 0424:223a Standard Microsystems Corp. 8-in-1 Card ReaderBus 008 Device 003: ID 0781:5150 SanDisk Corp. SDCZ2 Cruzer Mini Flash Drive (thin)
Bus 008 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 002: ID 04b8:0119 Seiko Epson Corp.
Bus 005 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
gerry@gst-ubuntu:~$ xsane &
[1] 8331
gerry@gst-ubuntu:~$ sudo xsane
[1]+ Done xsane
gerry@gst-ubuntu:~$ ls -l /dev/bus/usb/005/002
crw-rw-rw- 1 root scanner 189, 513 2006-05-15 07:54 /dev/bus/usb/005/002

The sudo xsane still works, and the xsane as a user gives the same result as before. So, I guess the use of the USB 2.0 hub is a non-issue.

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

This bug is still present in Dapper final. In fact it seems to be worse, since I can no longer to get sudo xsane to find the scanner while sudo sane-find-scanner still locates it.

This is a show stopper for my use of Ubuntu.

Revision history for this message
Gerry Tool (gerry-thetoolshed) wrote :

You can ignore the previous comment. On reboot this morning, I can scan as sudo.

However, I still cannot scan as a user, and this is important when using the scanner from any application like Gimp.
The situation is still:

(Copied from a previous comment)

The problem keeping this from working must be very minor. When I execute 'xsane &' as a user, the xsane interface opens and the scanner lights actually flash like the scanner is being initialized. The legend in the title bar of the main xsane window says "xsane 0.97 4.1a:002" The problem shows up when I try to preview or scan. An Error box pops up with the message "Failed to start scanner: invalid argument."

If I execute 'sudo xsane' , everything works correctly and the xsane window title bar legend says "xsane 0.97 Perfection 4490:002."

The same thing happens in Gimp whether using xsane or xscanimage.

Changed in sane-backends:
status: Needs Info → Confirmed
Revision history for this message
Peter D Knight (knightp) wrote :

I have ubuntu 6.06 and an acer scanner. I have all the errors as described. When I setup snapscan.conf for the first time, xsane worked and I scanned an immage. After a reboot I have the libusb error message.
Driver manager sees the scanner. As user no device .
I see in man sane-usb it says as below.
Ubuntu 6.06 has libusb0.1.4
Could this be the problem ???
Peter

LIBUSB
       SANE can only use libusb 0.1.6 or newer. It needs to be installed at
       build-time. Modern Linux distributions and other operating systems come
       with libusb.

Revision history for this message
Stephen Anthony (santhony) wrote :

The same problem continues to exist in Feisty (7.04) with 2.6.20-16-generic, which still uses libusb-0.1.4

While I can only verify it for my system, I followed the directions at http://www.sane-project.org/man/sane-artec_eplus48u.5.html, copying the firmware file over from the cd (the WinXP file), and I can now scan 16-bit 1200 dpi color. No other changes were necessary.

(Helpful hint: all initial settings in xsane were correct, except that it was set to scan only a 5 cm square. Correct that, and xsane works fine after doing the above.)

Revision history for this message
Peter D Knight (knightp) wrote : Re: [Bug 24946] Re: Detected scanner fails to load with "Invalid Argument"

Hi Stephen
Many thanks for the email.
I did copy the correct file over from my win 2000 system and you probably
missed that sane worked once and the scanner scanned and I was happy.
However after a reboot it has never worked again. I have almost forgotten
about it.
I'll have another go and let you know.
Regards
Peter
----- Original Message -----
From: "Stephen Anthony" <email address hidden>
To: <email address hidden>
Sent: Tuesday, June 05, 2007 6:42 AM
Subject: [Bug 24946] Re: Detected scanner fails to load with "Invalid
Argument"

The same problem continues to exist in Feisty (7.04) with
2.6.20-16-generic, which still uses libusb-0.1.4

While I can only verify it for my system, I followed the directions at
http://www.sane-project.org/man/sane-artec_eplus48u.5.html, copying the
firmware file over from the cd (the WinXP file), and I can now scan
16-bit 1200 dpi color. No other changes were necessary.

(Helpful hint: all initial settings in xsane were correct, except that
it was set to scan only a 5 cm square. Correct that, and xsane works
fine after doing the above.)

--
Detected scanner fails to load with "Invalid Argument"
https://bugs.launchpad.net/bugs/24946
You received this bug notification because you are a direct subscriber
of the bug.

Martin Pitt (pitti)
Changed in sane-backends:
assignee: pitti → nobody
Revision history for this message
Ingo Gerth (igerth) wrote :

I want to report that my scanner, a HP PSC 1350 stopped working in Hardy.
When opening xsane, I get the following error message:

Failed to open device 'v4l:/dev/video0':
Invalid argument.

I do even never see the main window.
The PSC 1350 is a all in one device, the printer still working. Scanning worked in all versions before Hardy.

If you need further information, please don't hesitate to contact me.
Here is the output of some commands:

ingo@ingo-laptop:~$ sudo sane-find-scanner
[sudo] password for ingo:

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x03f0 [hp], product=0x3b11 [psc 1300 series]) at libusb:006:003
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.
ingo@ingo-laptop:~$ sudo scanimage -L
device `v4l:/dev/video0' is a Noname USB 2.0 Camera virtual device
device `hpaio:/usb/psc_1300_series?serial=MY44KDF06B9F' is a Hewlett-Packard psc_1300_series all-in-one
ingo@ingo-laptop:~$ sudo scanimage -T
scanimage: open of device v4l:/dev/video0 failed: Invalid argument
ingo@ingo-laptop:~$ id
uid=1000(ingo) gid=1000(ingo) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),106(fuse),108(lpadmin),114(admin),124(sambashare),1000(ingo)
ingo@ingo-laptop:~$

Revision history for this message
michiel33 (michiel33) wrote :

I have the same error in Ubuntu 8.04 (Hardy). The scanner is detected (it makes a sound when I start Xsane) but when I press "scan", a popup message appears saying "failed to start scanner: invalid argument". It does NOT help if I start Xsane as root (by sudo).

Revision history for this message
Flo (doc-nice) wrote :

I think this is no dup of the scanner group problem, as even root cannot scan:

This seems to exist for any usb scanner, as some searching showed me.
I have the same problem using a brother mfc-215c (brother native backend).

It worked like a charm util i did a (debian) update. Now the same error occurs: failed to start scanner: invalid argument

scanimage returns:
[code]
scanimage: sane_start: Invalid argument
[/code]

and strace scanimage shows this:
[code]
open("/dev/bus/usb/001/002", O_RDWR) = 181
ioctl(181, USBDEVFS_SETCONFIGURATION, 0xbffdff94) = -1 EBUSY (Device or resource busy)
ioctl(181, USBDEVFS_CLEAR_HALT, 0xbffdff94) = 0
ioctl(181, USBDEVFS_CLAIMINTERFACE, 0xbffdffc4) = 0
[/code]

maybe also a bug in libusb?

lsusb output is:
[code]
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 04f9:0193 Brother Industries, Ltd MFC-215C
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[/code]

Revision history for this message
Flo (doc-nice) wrote :

Ignore my last report and take this solution instead:

The problem about the device state EBUSY is that my device has a cardreader attached and is a printer:
lsmod showns usblp and usb_storage being loaded.
This causes the EBUSY state, wehen doing
modprobe -r usblp and modprobe -r usb_storage, the scanner is working fine.

At another page, I read about someone having patched xsane to ignore EBUSY, this seemns to work "correctly enough" to be useable.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Oddly enough this "magically" started working for me after I installed libsane-extras.. Try it
sudo apt-get install libsane-extras

Revision history for this message
Ray Stuart (raystuart) wrote :

Thanks... same here. It "magically" started working for me after installing libsane-extras. This is for a Brother MFC-5440CN, scanning over the network.

Revision history for this message
stop (whoopwhoop) wrote :

Hey Ray Stuart, I've got a Brother DCP-115C, I can't get it to scan:
failed to open device 'brother2:bus2;dev1': invalid argument.
What version of ubuntu are you running? I am running 10.04, it was working fine in 8.04

Revision history for this message
Alen Milincevic (alen-milincevic) wrote :

Regarding "'artec_eplus48u", here is the manual working solution for Ubuntu 10.10 (possibly also applicable to Ubutnu 10.04 and some versions before that, down to year 2007, according to web sites).

After doing:

sane-find-scanner

, this is the result for a MEDION MD4394:

found USB scanner (vendor=0x05d8, product=0x4003, chip=GT-6816) at libusb:003:002

Keep in mind, there are possibly two different revisions of this scanner family.

===> Solution 1 (possible first revision):
This scanner might be possibly misidentified to work with the gt68xx driver (http://www.meier-geinitz.de/sane/gt68xx-backend/). The procedure should be, to add following lines to the end of /etc/sane.d/gt68xx.confm to perform manual override:

usb 0x05d8 0x4003
override "artec-ultima-2000"
firmware "Artec48.usb"

Also, the firmware is required!!!!!! It must be placed in /usr/share/sane/gt68xx/ .
After that, the scanner in question responds, but may stall or make weird noises due to be variant 2 chipset.

===> Solution 2 (worked in my case):
More probable match is the artec_eplus48u backend.
The file /etc/sane.d/artec_eplus48u.conf must be modified. Add the end, add this:

# --------------------------------------------------------------------------
# MD4394 test
usb 0x05d8 0x4003
option artecFirmwareFile /usr/share/sane/artec_eplus48u/Artec48.usb
option ePlusPro 1
option vendorString "Artec"
option modelString "MD 4393"

Also, the firmware is required!!!!!! It must be placed in /usr/share/sane/artec_eplusu/ .

===> Also - possible backend override may be neccessary:
/etc/sane.d/dll.conf must possibly be modified.
In my case, it loaded automatically the unmatching in the list (gt68xx), which was wrong match. So comment out this line :

gt68xx

into

#gt68xx

and artec backend will be used instead.

===> Also - firmware is mandatory:
Firmware can be, for example, gotten from windows CD (in the driver directory, usually the file with extension .usb). It is neccesary to exist in the correct /usr/share/sane subdir, in order for the scanner to work.
Firmware name might diffe, keep that in mind. But usually has an extension .usb.

===> Suggestion:
I suggest, that sll this, now done manually, should be made somehow automatically working in Ubuntu in future (i.e. a wizard with possible subtypes, when this PID is detected). This would make life easier,

===> Other distros:
The procedure is the same for other distros with sane, except the location of firmware and sane config dirs might differ.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xsane (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.