HowTo: Brother MFC-7340, print/scan drivers

Archived topics about LMDE 1 and LMDE 2
Locked
mechanizedmedic

HowTo: Brother MFC-7340, print/scan drivers

Post by mechanizedmedic »

i had my brother MFC-7340 multi-function printer working in ubuntu but it took me a bit to get it rolling in LMDE. i created the script below to do most of the work. here's the whole process...

1) copy the script into your favorite text editor and save it as "brothermfc7340_LMDE.sh"
2) make the script executable $ sudo chmod 777 brothermfc7340_LMDE.sh
3) run the script $ sudo ./brothermfc7340_LMDE.sh
4) at the end of the script your browser should open up to the CUPS admin page. add the printer and choose your settings.

NOTES: i'm using xsane for a scanning gui and the permission fix that Brother provides doesn't work, therefore, it has to be run as root. i simply added gksu to the launcher command. there is also a bug in GTK2 that causes xsane to crash with certain themes (like clearlooks). changing themes worked for me.

EDIT (10/23/12): added some tweaks for scanner support. to enable network scanning check out this thread http://ubuntuforums.org/showthread.php?t=1519201

Code: Select all

#!/bin/sh
#designed for LMDE (update 4)
#script_name="brothermfc7340_LMDE.sh"

# Script must run as root
if [ $(id -u) -ne 0 ]; then
        echo "You need to run this script as root."
        echo "Use 'sudo ./$script_name' then enter your password when prompted."
        exit 1
fi

# make the required directories
mkdir -p /var/spool/lpd
mkdir -p /usr/share/cups/model
mkdir -p /usr/lib/sane

#install scan dependancies
apt-get install -y sane-utils psutils tcsh lib32stdc++

#sym link cups/lpd
ln -s /etc/init.d/cups /etc/init.d/lpd

#download and install .deb files
if [ $(uname -m) = "x86_64" ]; then
# 64-bit
  wget http://www.brother.com/pub/bsc/linux/dlf/brmfc7340lpr-2.0.2-1.i386.deb http://pub.brother.com/pub/com/bsc/linux/dlf/cupswrapperMFC7340-2.0.2-1.i386.deb http://pub.brother.com/pub/com/bsc/linux/dlf/brscan3-0.2.11-4.amd64.deb http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.1-3.amd64.deb http://pub.brother.com/pub/com/bsc/linux/dlf/brmfcfaxcups-1.0.0-1.i386.deb
  dpkg -i --force-all --force-architecture brmfc7340lpr-2.0.2-1.i386.deb cupswrapperMFC7340-2.0.2-1.i386.deb brscan3-0.2.11-4.amd64.deb brscan-skey-0.2.1-3.amd64.deb brmfcfaxcups-1.0.0-1.i386.deb
else
# 32-bit
  wget http://www.brother.com/pub/bsc/linux/dlf/brmfc7340lpr-2.0.2-1.i386.deb http://pub.brother.com/pub/com/bsc/linux/dlf/cupswrapperMFC7340-2.0.2-1.i386.deb http://www.brother.com/pub/bsc/linux/dlf/brscan3-0.2.11-4.i386.deb http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.1-3.i386.deb http://pub.brother.com/pub/com/bsc/linux/dlf/brmfcfaxcups-1.0.0-1.i386.deb
  dpkg -i --force-all --force-architecture brmfc7340lpr-2.0.2-1.i386.deb cupswrapperMFC7340-2.0.2-1.i386.deb brscan3-0.2.11-4.i386.deb brscan-skey-0.2.1-3.i386.deb brmfcfaxcups-1.0.0-1.i386.deb
fi

#add user to lpr group
usermod -aG lpadmin "$USER"

#enable normal user to access the scanner
sed -i '/autosuspend/i\# Brother scanner\nATTRS{idVendor}=="04f9", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"' /lib/udev/rules.d/60-libsane.rules

#run post installation scripts (fixes)

  /usr/local/Brother/inf/setupPrintcap MFC7340 -i USB
  /usr/local/Brother/inf/braddprinter -i MFC7340

  if [ -d /usr/lib32 ]
    then ln -s /usr/lib/libbrcomplpr2.so /usr/lib32/libbrcomplpr2.so
  fi

  if [ -e /etc/init.d/lprng ]; then
     /etc/init.d/lprng restart
  elif [ -e /etc/init.d/lpd ]; then
     /etc/init.d/lpd restart
  fi

  if [ ! -e /usr/sbin/pstops ]
    then PSTOPS=`which pstops`
      if [ "`echo $PSTOPS | grep -i cups`" != "" ]
	then PSTOPS=""
      fi
      if [ "$PSTOPS" != "" ]
	then	echo [psconvert2]   >>/usr/local/Brother/inf/brMFC7340func
		echo pstops=$PSTOPS >>/usr/local/Brother/inf/brMFC7340func
      fi
  fi

  if [ -e /bin/sh ]
      then sh /usr/local/Brother/cupswrapper/cupswrapperMFC7340-2.0.2 -i
    elif [ -e /bin/bash ]
      then bash /usr/local/Brother/cupswrapper/cupswrapperMFC7340-2.0.2 -i
    else 	echo ''
	  echo '****** ERROR: bash is required. ******'
  fi

#create symlinks for installed files
ln -s /usr/lib64/sane/libsane-brother3.so.1.0.7 /usr/lib/sane/libsane-brother3.so.1.0.7
ln -s /usr/lib64/sane/libsane-brother3.so.1 /usr/lib/sane/libsane-brother3.so.1
ln -s /usr/lib64/sane/libsane-brother3.so /usr/lib/sane/libsane-brother3.so
ln -s /usr/lib64/libbrscandec3.so /usr/lib/libbrscandec3.so
ln -s /usr/lib64/libbrscandec3.so.1 /usr/lib/libbrscandec3.so.1
ln -s /usr/lib64/libbrscandec3.so.1.0.0 /usr/lib/libbrscandec3.so.1.0.0


#display cups webui
echo ''
echo 'installation completed'
sleep 2
echo 'cups admin will now launch in your browser'
sleep 2

xdg-open http://localhost:631/admin
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jasmineaura

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by jasmineaura »

Cool. would be nice if you could package it, say as printer-brother-mfc-7xxx-nonfree, and you can probably look at flashplugin-nonfree for an example.

Would also be wise to change all instances of `mkdir` to `mkdir -p`, and use "ln -s" to make symbolic links for files from /usr/lib64 to /usr/lib (instead of "cp").
mechanizedmedic

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by mechanizedmedic »

jasmineaura wrote:Cool. would be nice if you could package it, say as printer-brother-mfc-7xxx-nonfree, and you can probably look at flashplugin-nonfree for an example.

Would also be wise to change all instances of `mkdir` to `mkdir -p`, and use "ln -s" to make symbolic links for files from /usr/lib64 to /usr/lib (instead of "cp").
thanks! i just edited the OP to reflect your later suggestions. i tried a while back to package these for personal use but my high levels of noobishness prevented a functional installation. :oops:
rv7charlie

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by rv7charlie »

Words fail me in expressing my gratitude! I purchased this printer months ago, & have been struggling to get it set up. Using your process, the task was accomplished in only a few minutes. I've been trying hard to wean myself off MS for a while, but persistent issues like printer setup in the various flavors of linux has made it tough for a 'user' like me.

Any idea about whether this process will allow my wife's computer to 'see' this printer with it attached to my computer (set up as shared, and on the same network)?

Thanks,

Charlie
mechanizedmedic

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by mechanizedmedic »

Hi Charlie,

Thanks for the positive feedback. :)

So far as printer sharing, if Windows clients are involved I know that the "easiest" way is Samba. Personally I've never had good/consistent results with Samba so I manually configure CUPS on all of my servers and clients. Since you already have CUPS installed on the computer that has the printer connected, go to http://localhost:631. This is the CUPS admin UI, and you should be able to set printer sharing somewhere in the Administration tab. This will make your computer a print server for that printer. If you need to share to Windows/Mac clients i'm not of much help there but CUPS should be able to do this too.

Also, the Arch Linux wiki has some good info on CUPS setup, but keep in mind some things are going to be different in Mint/Debian.

Cheers,
MechanizedMedic
rv7charlie

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by rv7charlie »

Thanks for the quick reply. I do still have a couple of Windows boxes on the network, but my primary focus is my wife's desktop, which is also running Mint on the network with my Mint desktop. Can I simply run your process on her computer & have it 'see' the printer that's attached through USB to my computer? (My computer is configured to share the printer; I'll attempt to attach a screenshot.)

Again, this 'user level' newbe is very grateful for the help.

Charlie
printerscreenshot_html_17632af2.jpg
mechanizedmedic

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by mechanizedmedic »

rv7charlie wrote:Thanks for the quick reply. I do still have a couple of Windows boxes on the network, but my primary focus is my wife's desktop, which is also running Mint on the network with my Mint desktop. Can I simply run your process on her computer & have it 'see' the printer that's attached through USB to my computer? (My computer is configured to share the printer; I'll attempt to attach a screenshot.)

Again, this 'user level' newbe is very grateful for the help.

Charlie
I'm at work until the wee hours of the morning, but here is a quick link to an Ubuntu help doc https://help.ubuntu.com/community/Netwo ... rom_Ubuntu. This should give you a good general idea of the setup. If it doesn't work post back and I'll try to get some better info when I get home.
AmigoNico

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by AmigoNico »

Just wanted to say thanks; my 7340 had been a boat anchor since I switched to LMDE, but now it works better than it did on the Ubuntu-based version.
rv7charlie

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by rv7charlie »

Just tried to do updates to my system & got an error message that says:
"
An error occurred
The following details are provided:

E: The package brmfc7340lpr:i386 needs to be reinstalled, but I can't find an archive for it.
E: Internal error opening chache (1). Please report.
Close
"
None of the numerous listed updates seem to occur, and when I click 'close' on this message, the Update Manager also closes. Synaptic Package Manager also displays the same message. This package name looks similar, but not identical to the package for the Brother printer. Anyone run into this issue recently?

Thanks,

Charlie
rv7charlie

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by rv7charlie »

Well, I found a fix for the previous issue, but now have a 'back to square one' issue.

I did a 'clean' install (new hard drive, new computer) of Mint14. I performed the process detailed at the beginning of this thread on the new system. After the process ran & Cups admin opened in my browser, I could not print a test page, nor could I scan an image. Anyone have any thoughts on how I should proceed?

Thanks,

Charlie
that $40 deal on Win8 is starting to look better & better.... :-(
Conzar

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by Conzar »

Thank you very much. Although I am not using mint (yet), your script worked great! Thank you very much for your time and effort putting this together!
benf101

Re: HowTo: Brother MFC-7340, print/scan drivers

Post by benf101 »

In the past I have spent over an hour setting this up with the crazy wrappers and everything. Your script worked awesomely and saved me a LOT of time. Thank you!
Locked

Return to “LMDE Archive”