Ubuntu – Invalid argument – Brother scanner not working after upgrade (brscan2 driver)

13.10brothermintscanner

I recently upgraded Ubuntu 13.10 (Saucy).

Scanning via my MFC-420CN had been working in Ubuntu and Linux Mint installs up though Olivia and Oneric. However once I upgraded from these, scanning broke. I installed a fresh copy of saucy to verify that it wasn't just something to do with the upgrade.

Brother's website has a notice that all brscan1 models no longer support usb scanning as of Ubuntu 11.10, but it doesn't seem to apply for brscan2 and brscan3 models. Moreover I found several other posts that seem to indicate at least brscan4 models are currently working. However I have been unable to verify scanners using brscan2 (or other divers other than brscan4) and ubuntu 13.10 (actually 12.10 and greater) are currently functioning.

For cross-referencing / to help others with the problem the complete list of brscan2 scanners is as follows:

DCP-110C DCP-115C DCP-117C DCP-120C DCP-130C DCP-135C DCP-150C
DCP-153C DCP-155C DCP-310CN DCP-315CN DCP-330C DCP-340CW DCP-350C
DCP-353C DCP-357C DCP-540CN DCP-560CN DCP-7010 DCP-7020 DCP-7025
DCP-750CW DCP-770CW DCP-8060 DCP-8065DN MFC-210C MFC-215C MFC-230C
MFC-235C MFC-240C MFC-260C MFC-3240C MFC-3340CN MFC-3360C MFC-410CN
MFC-420CN MFC-425CN MFC-440CN MFC-465CN MFC-5440CN MFC-5460CN MFC-5840CN
MFC-5860CN MFC-620CN MFC-640CW MFC-660CN MFC-665CW MFC-680CN MFC-685CW
MFC-7220 MFC-7225N MFC-7420 MFC-7820N MFC-820CW MFC-845CW MFC-8460N
MFC-8660DN MFC-8670DN MFC-885CW MFC-8860DN MFC-8870DW MFC-9420CN

Similar previously asked questions / problems (but for brscan3 driver hardware):


So far I've tried:

  • Installing sane-utils

  • irections at brother's website regarding the brscan2 install, including using the dpkg -f flag

  • editing /lib/udev/rules.d/40-libsane.rules to include

code:

# Brother scanners

ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"
  • copying files form lib to lib64:

code:

cd /usr/lib
ln -s ../lib64/libbrscandec2.so.1.0.0 .
ln -s ../lib64/libbrcolm2.so.1.0.1 .
ln -s ../lib64/libbrcolm2.so .
ln -s ../lib64/libbrscandec2.so.1 .
ln -s ../lib64/libbrscandec2.so .
ln -s ../lib64/libbrcolm2.so.1
cd sane
ln -s ../../lib64/sane/libsane-brother2.so.1.0.7 .
ln -s ../../lib64/sane/libsane-brother2.so.1 .
ln -s ../../lib64/sane/libsane-brother2.so .
  • installing ia32-libs and repeating the sane-utils install
  • removing the 64 bit brscan2 driver and replacing it with the 32 bit one, but results of scanimage with the 32 bit driver set-up for usb or network mode were less than promising:

code:

# 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).
  • of the 32 bit windows drivers with WINE eumlating Win2000 or XP — it almost completes in 2000.

Debugging 64 bit drivers:

With brscan2 installed I can open up simple-scan and find the scanner; moreover scanimage output indicates that everything is okay:

# scanimage -L
device `brother2:bus5;dev2' is a Brother DCP-350C USB scanner

But scanning (even as a root user) still doesn't work.

> sudo scanimage >image.pnm
scanimage: open of device brother2:bus2;dev4 failed: Invalid argument

xsane produces a similar error:

 Failed to start scanner: Invalid argument

sane-find-scanner produces a pipe error shown here:
http://pastebin.com/tTNMyD1m
but that seems to related to the fact that brother is providing the driver, not sane.

I'm pretty stuck at this point, any help would be appreciated.

Best Answer

After I update to 13.10 I got the same error when scanning. There are two problems here.

  1. The error Invalid argument is not a argument problem, but is a write access problem.
  2. The other problem is that the bus and dev number are wrong from the scanimage error.

How to find and fix the problem?

Install the brscan4 drivers from the brother website

sudo dpkg -i brscan4-0.4.2-1.amd64.deb

Check to see if it works

sudo brsaneconfig4 -d

Test to see if the scanner is installed (scanner need to be powered on). And run as a user NOT root

$ scanimage -L
device `brother4:bus5;dev1' is a Brother ADS-2000 USB scanner
$ scanimage --test
scanimage: open of device brother4:bus5;dev1 failed:
Invalid argument

or

$ scanimage
scanimage: open of device brother4:bus5;dev1 failed:
Invalid argument

You can use the following script to update the permissions for the scanner.

lsusb | grep -i brother | sed 's/://' | awk '{printf "/dev/bus/usb/%s/%s", $2,$4}' | xargs -i -t sudo chmod 666 "{}"

lsusb lists usb devices

grep -i brother will find the brother device (assumption I made is you have only one brother device connected to the USBs at a time)

sed 's/://' | awk '{printf "/dev/bus/usb/%s/%s", $2,$4}' will find the bus & device numbers

xargs -i -t sudo chmod 666 "{}" will add write permission to scanner

Here is more detailed information on why we did what we did above

To find out where the brother scanner is on the bus use lsusb. This is one of the problems in the scanimage. The bus is 003 and the device is 002 and not bus 5, dev 1 as per scanimage

$ lsusb
Bus 003 Device 002: ID 04f9:60a0 Brother Industries, Ltd**  
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
...

To fix the problem, you will need to use the path based on the location of the brother scanner in the lsusb command. In my case it was bus 003 and device 002. Note that if you unplug the USB cable to the scanner and plug it back in the device, you will get a new number and/or bus. (The number return back to 2 when you reboot the PC)

Examples:

sudo cd /dev/bus/usb/003
sudo chmod 666 002

or just:

sudo chmod 666 /dev/bus/usb/003/002

Scanimage need to fix the message when it can not access the scanner to have the right bus and dev number and also tell the user that the problem is a write access problem.

Brother needs to update the driver code so that global user can write to the scanner i.e. chmod 666 to the scanner driver location

Related Question