Feb 26, 2011

Functionalizing the "Scan-To"-button of Brother all-in-one printers for Ubuntu 10.10

This is a mere condensation of all the information given on the Brother website and my post on the partner blog. The procedure is valid for Ubuntu 10.04 and 10.10 with respect to at least the models DCP-7010, MFC-7420, MFC-7820N - connected via USB, probably for more. Please consult the Brother website if in doubt.

Update 2013-01-20: same works with a MFC-7360N.  (Use the packages appropriate for this model in the section below instead) The only change is, that the new scan-to-key tool has moved all its files to /opt/brother/scanner so put all scan scripts there and edit the appropriate .cfg file there.

  1. Connect and switch on your All-in-one Brother device via USB
  2. Check in your package management, if sane-utils and psutils are installed. If not, install them.
  3. Download the scanner driver for your model, depending of your system the 32bit or 64bit version - in any case: the .deb-File
  4. Install it by opening a console, navigating to the folder where you saved the driver, becoming root and casting the command:
    dpkg -i --force-all [brscan-driverpackage].deb
    and test if it was installed correctly
    dpkg -l | grep Brother
  5. Make the scanner available for all users: cast (with root console)
    gedit /lib/udev/rules.d/40-libsane.rules
    This opens a text editor with the file in question. Add the following lines before the line "# The following rule will disable ...":
    # Brother scanners
    ATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"
    and save the file.
  6. Restart your computer!
  7. Download the appropriate scan-key-tool for your system (deb)
  8. Install it by opening a console, navigating to the folder where you saved the driver, becoming root and casting the command:
    dpkg -i --force-all [brscankeytoolname].deb
    and test if it was installed correctly
    dpkg -l | grep Brother
  9. Open a user console (not root!) and cast:
    brscan-skey
    and check if the scankey-tool finds your scanner by
    brscan-skey -l
  10. If your device was found properly, change the brscan-scripts to your needs as has been posted here. For quick copy and paste, the scripts are all in
    cd /usr/local/Brother/sane/script
  11. If all scripts work as you want them to work, don't forget to create an entry in "System --> Settings --> Autostart" with starting command brscan-skey for all users who need to use the "scan-to" key of your All-in-One device.
As an example, if you have installed the package imagemagick, you can adjust the "scantoimage"-script for aquiring a picture and saving it in *.jpg with a size not bigger than 420kB for a DIN A4 page - the script is taken as it is installed from Brother, just the last two lines are different:
#! /bin/sh
set +o noclobber
#
# $1 = scanner device
# $2 = friendly name
#

#
# 100,200,300,400,600
#
resolution=200
device=$1
mkdir -p ~/brscan
if [ "`which usleep`" != '' ];then
usleep 10000
else
sleep 0.01
fi
output_file=`mktemp ~/brscan/brscan.XXXX`
echo "scan from $2($device) to $output_file"
scanimage --device-name "$device" --resolution \

  $resolution -y 298.00 > $output_file
# following the original line from brother:
# echo gimp $output_file \;rm -f $output_file | sh &
#
# instead we use imagemagick to directly convert it

# into a jpg picture
# < 420 kB 

convert $output_file -define jpeg:extent=420kb \
  $output_file.jpg
rm $output_file  # removes the temporary scan file

Remark for devices with ADF:
I found additional information and ideas of scripts for using the ADF (automatic document feeder) via wiki.ubuntuusers.de (sorry guys, a German site) on this website (english).
A script enabling scanning over the ADF tested with the MFC-7420 (should work on the MFC-7820N as well) is presented in this follow-up post.

No comments: