You are not logged in.

#1 2016-04-05 02:44:10

geo909
Member
Registered: 2008-09-07
Posts: 309

[SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Hi all,

I have a brother DCP 7020 printer/scanner. I used to print and scan with it in my previous computer running arch linux without problems. Now I have a new laptop, and I tried to set it up again. I installed 'foomatic-db' and got the printer to work with cups. However I'm having problems getting the scanner to work. In particular, when I run xsane, I get a pop-up saying

"Failed to open device `brother2:bus4;dev1': Invalid argument"

I also tried simple-scan, and I got a "Failed to scan. Unable to connect to scanner" message.

Following the wiki for brother scanners, I installed the package brscan2 that corresonds to my model. After installing it, the scanner seems to be detected:

$ scanimage -L
device `brother2:bus4;dev1' is a Brother DCP-7020 USB scanner
device `v4l:/dev/video0' is a Noname Laptop_Integrated_Webcam_E4HD virtual device
$ lsusb | grep Brother
Bus 003 Device 006: ID 04f9:0183 Brother Industries, Ltd DCP-7020

Something that seems to be problematic is that xsane is considering "bus4;dev1", wheras lsusb shows something about bus 3 and dev 6.

Anybody has any clue what's going on?

PS. I rebooted both laptop and scanner after installing the packages and added my user to the scanner group. Also, the only difference between this and the previous laptop where the scanner worked, is that the new is 64bit and the old was 32bit.
PS2. This does not seem to be a permission problem either; I checked that there is a line for my printer in the udev rules file.

Last edited by geo909 (2016-04-05 19:36:57)

Offline

#2 2016-04-05 06:17:27

pb
Member
From: Krakow, PL
Registered: 2014-12-26
Posts: 336
Website

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Have you got /etc/sane.d/brother.conf? It should be with line looks like this:

usb 0x04f9 0x0183

Inspect your /etc/sane.d/dll.conf, also. There should be line with: brother2.
Check /lib/udev/rules.d/49-sane.rules. It should be line looks like this:

# Brother DCP-7020
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="0183", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Last edited by pb (2016-04-05 06:18:39)

Offline

#3 2016-04-05 14:23:04

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Thanks for the reply.

pb wrote:

Have you got /etc/sane.d/brother.conf? It should be with line looks like this:

usb 0x04f9 0x0183

Hmm.. There's no brother.conf file in there. There are a lot of other .conf files, but not for brother.

Inspect your /etc/sane.d/dll.conf, also. There should be line with: brother2.

That was there. In fact there were three lines with "brother2".

Check /lib/udev/rules.d/49-sane.rules. It should be line looks like this:

# Brother DCP-7020
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="0183", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Yes, that was there.

So there is the brother.conf missing.. Would that be the culprit?

Offline

#4 2016-04-05 15:58:31

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Ok, problem solved. After reading this post I created a file `/lib/udev/40-libsane.rules` (it wasn't there) and added:

1. Open "/lib/udev/rules.d/40-libsane.rules" file.
2.Add the following two lines to the end of the device list.

# Brother scanners
ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"

After rebooting I was able to use simple-scan.

Is this missing file a bug? Should I bring this up to a maintener of some package or something?

Last edited by geo909 (2016-04-05 15:58:56)

Offline

#5 2016-04-05 19:11:22

krabat
Member
Registered: 2014-07-03
Posts: 40

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Your homebrew udev rules file is actually doing the same thing as the line corresponding to your device in /usr/lib/udev/rules.d/49-sane.rules, it's just a bit less strict regarding selection and permissions. The line in /usr/lib/udev/rules.d/49-sane.rules corresponding to the Brother MFC-215C which is working flawlessly here is the same except the deviceID.
So that udev rules file looks rather like a workaround, not the solution.

A backend configuration file /etc/sane.d/brotherN.conf isn't provided by upstream and seems by no means obligatory as it doesn't exist on the system the said Brother MFC-215C is connected to either.
Same applies to the apparent inconsistency between usb device numbering as stated by lsusb and 'scanimage -L' respectively. Same here, but scanner does work.
Membership in group scanner isn't needed any longer.
Several copies of line 'brother2' in /etc/sane.d/dll.conf are probably due to the predecessor package brscan2 not removing these upon uninstall. This shouldn't happen any longer using the current package.

Basically current AUR package brscan2, which I'm maintaining btw., seems to work as expected. Just tested it on a laptop where neither this package nor sane in general had been installed before.
After installing xsane the system needs to be rebooted in order to make xsane recognize available devices, but that's what you did. (Maybe some udevadm invocation can do the trick, too. Didn't test this.)

Did you eventually restore some old [x]sane settings when setting up your new laptop? I'm asking as faulty settings in ~/.sane/xsane/* can very well cause the error message you're facing. You could eventually remove directory ~/.sane/xsane while xsane isn't running.
If you're interested in tracking this down further you could undo all unneeded modifications, reboot the system and see whether scanning from the command line by running e. g.

$ scanimage --format=PNG > test.png

works (assuming only one scanner device is attached).

Offline

#6 2016-04-05 19:36:02

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

krabat wrote:

Your homebrew udev rules file is actually doing the same thing as the line corresponding to your device in /usr/lib/udev/rules.d/49-sane.rules, it's just a bit less strict regarding selection and permissions. The line in /usr/lib/udev/rules.d/49-sane.rules corresponding to the Brother MFC-215C which is working flawlessly here is the same except the deviceID.
So that udev rules file looks rather like a workaround, not the solution.

A backend configuration file /etc/sane.d/brotherN.conf isn't provided by upstream and seems by no means obligatory as it doesn't exist on the system the said Brother MFC-215C is connected to either.
Same applies to the apparent inconsistency between usb device numbering as stated by lsusb and 'scanimage -L' respectively. Same here, but scanner does work.
Membership in group scanner isn't needed any longer.
Several copies of line 'brother2' in /etc/sane.d/dll.conf are probably due to the predecessor package brscan2 not removing these upon uninstall. This shouldn't happen any longer using the current package.

Basically current AUR package brscan2, which I'm maintaining btw., seems to work as expected. Just tested it on a laptop where neither this package nor sane in general had been installed before.
After installing xsane the system needs to be rebooted in order to make xsane recognize available devices, but that's what you did. (Maybe some udevadm invocation can do the trick, too. Didn't test this.)

Did you eventually restore some old [x]sane settings when setting up your new laptop? I'm asking as faulty settings in ~/.sane/xsane/* can very well cause the error message you're facing. You could eventually remove directory ~/.sane/xsane while xsane isn't running.
If you're interested in tracking this down further you could undo all unneeded modifications, reboot the system and see whether scanning from the command line by running e. g.

$ scanimage --format=PNG > test.png

works (assuming only one scanner device is attached).

Thanks for all the info. I didn't restore anything from my old laptop, the installation of sane, xsane, and brscan2 was fresh, using pacman and yaourt, nothing custom. I did uninstall and install them a couple of times while trying to figure the problem out, so maybe that's why I had the multiple lines in my dll.conf.

Since my scanner works now, I'm happy and I think I won't tinker with it any longer. If however you think that tracking this down further could contribute to improve the package, I'll do, just let me know.

Last edited by geo909 (2016-04-05 19:36:23)

Offline

#7 2016-04-05 20:45:36

krabat
Member
Registered: 2014-07-03
Posts: 40

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Of course one reason to post was to figure out whether there's eventually something wrong with package brscan2. But actually I didn't see any real evidence for this so far.
So if you should run scanimage as suggested in order to test I'd find it interesting to know, but if you just want to keep things running as they do right now it's no problem either.

One more note: besides told otherwise in the thread on ubuntuforums.org the custom udev file does belong to /etc/udev/rules.d. In /usr/lib chances are it will be overwritten should a system-wide file at this path be introduced one day.

Offline

#8 2016-04-05 21:27:19

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

I played around a little more and I think I figured it out. You were right, the extra file in /lib/udev/rules.d is irrelevant, I removed it. What made a difference was plugging the scanner in a different usb port and rebooting. Of course I had used all the different ports in the beginning, but I hadn't rebooted after changing the port.

The funny thing is that after using the 'correct' port and rebooting, then after boot up I can change the usb port to the 'bad' ones and the scanner still works. Or I'm missing something and it's just a coincidence.

In any case, now everything works with just brscan2 with no extra rules and no tinkering whatsoever. I'm not sure why it didn't work in some ports but it does now, so the package is obviously fine and my scanner works fine.

Thanks for the help and sorry for the false alarm!

Offline

#9 2017-01-30 11:49:11

benoitldr
Member
From: Grenoble
Registered: 2016-03-03
Posts: 29

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Hello,

Thanks you for the post, I have done all the manipulation from this post and it's works with scanner Brother DCP-1510 !

Benoit

Offline

#10 2017-11-10 13:01:06

Rickrock
Member
From: The Netherlands
Registered: 2014-11-23
Posts: 46

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Old thread, but I have an old printer. wink

Should the printer be listed in the /usr/lib/udev/rules.d/49-sane.rules file after installation?

I have a dcp-135c and it is not.

Making a new file also did the trick though...

Last edited by Rickrock (2017-11-10 13:11:25)

Offline

#11 2017-11-10 14:12:22

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,249

Re: [SOLVED]Brother scanner won't work with xsane; "Failed to open device"

Glad to hear you solved this however please don't make a habit of necrobumping.

https://wiki.archlinux.org/index.php/Co … bumping.22

Closing.

Offline

Board footer

Powered by FluxBB