I driver forniti dalla Brother sono in due pacchetti (deb o rpm): uno con il driver per il sistema di stampa LPD (il vecchio Line Printer Daemon) e l'altro con un wrapper per CUPS. Fin qui niente di strano, se non che il mio server di stampa è un OrangePi Lite con processore ARM ed i pacchetti sono compilati per Intel 386. Questa è stata una grossa svista da parte mia ed ovviamente, installati i pacchetti sull'OrangePi, la stampante non funzionava
Prima ho dovuto sistemare il wrapper per CUPS, cosa abbastanza semplice visto che la Brother ha rilasciato i codici sorgenti con licenza GPL. Quindi ho compilato l'eseguibile brcupsconfig e l'ho sostituito a quello installato dal pacchetto. Rimaneva da sistemare l'altro eseguibile, cioè il filtro usato dal driver di LPD. Per quello ahimé, non ci sono i codici sorgenti ufficiali, ma un tizio lo ha ricreato ed ha messo il suo codice su GitHub. Compilato e copiato anche quello, ho riscritto la configurazione della stampante nel file /var/run/cups/printcap, che dovrebbe essere fatta in automatico all'installazione del pacchetto deb, ma che non era andata a buon fine.
Fatto tutto questo, la stampante ha preso magicamente a funzionare
Quindi per ricapitolare, la Brother fornisce due pacchetti per far funzionare la stampante con LPD e CUPS. In questi pacchetti oltre al file PPD (Postscript Printer Description) ed ai file di informazioni per LPD, ci sono vari script BASH ed un paio di eseguibili per Intel 386. Quindi per installare il tutto su ARM (ma anche su x86-64 sarebbe uguale) ho fatto così:
- ho installato i file del pacchetto hl1110lpr, contenente i file per la stampa con LPD
- ho installato i file del pacchetto hl1110cupswrapper, contenente i file di configurazione per CUPS e l'interfaccia con LPD
- ho compilato dai sorgenti forniti dalla Brother l'eseguibile brcupsconfig per configurare la stampante con CUPS
- ho compilato dai sorgenti trovati su GitHub il filtro per LPD rawtobr3, che converte il PostScript in una immagine
- ho riscritto la configurazione in /var/run/cups/printcap, cosa che può essere fatta in automatico lanciando lo script di configurazione /opt/brother/Printers/HL1110/inf/setupPrintcap
- ho creato uno script BASH per sostituire l'eseguibile /opt/brother/Printers/HL1110/lpd/brprintconflsr3 che serve a cambiare la configurazione della stampante (vedi sotto)
N.B. in grassetto gli aggiornamenti, qui sotto gli allegati
/opt/brother/Printers/HL1110/lpd/brprintconflsr3
Codice: Seleziona tutto
#!/bin/bash
#
# Brother Printer configuration editor
# Copyright (C) 2020 Stefano Guidoni
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
BASEDIR=`dirname $0`
RCFILE="$BRPRINTERRCFILE"
FUNCFILE=""
OPTION="none"
ARGARR=(-res -ps -dx -dxt -pt -md -cp -sp -ts)
OPTARR=(Resolution PaperSource Duplex DuplexType PaperType Media Copies Sleep TonerSaveMode)
OUTPUTRC=""
# Check the number of parameters
# we need four
if [ "$#" -ne 4 ]; then
echo "Illegal number of parameters, must be four"
exit
fi
# Check the first argument (printer name)
if [ $1 = "-P" ]; then
if [ "$BRPRINTERRCFILE" = '' ]; then
RCFILE="${BASEDIR}/../inf/br${2}rc"
fi
FUNCFILE="${BASEDIR}/../inf/br${2}func"
else
echo "The first argument must be a printer name, e.g. -P HL1110"
exit
fi
# Check if configuration file exists
if [ ! -e "$RCFILE" ]; then
echo "Configuration file $RCFILE not found"
exit
fi
# Check if function file exists
if [ ! -e "$FUNCFILE" ]; then
echo "Function file $FUNCFILE not found"
exit
fi
# Find the option to set
for ((i=0;i<${#ARGARR[*]};i++)); do
if [ $3 = ${ARGARR[$i]} ]; then
OPTIONLIST=`cat $FUNCFILE | \
sed -n '/\[SelectionItem\]/,$p' | \
sed 'y/{}/,,/;s/ //g' | \
grep ${OPTARR[$i]}=`
# Check if the value is valid for the selected option
if [[ "$OPTIONLIST" =~ ",${4}," ]]; then
OPTION="${OPTARR[$i]}="
elif [[ $4 =~ ^[0-9]+$ ]] && [[ $OPTIONLIST =~ \"[0-9]*-[0-9]*\" ]]; then
RANGE=$(seq -s, `echo $OPTIONLIST | sed 's/.*"\([0-9]*\)-\([0-9]*\)".*/\1 \2/'`)
if [[ ",${RANGE}," =~ ",${4}," ]]; then
OPTION="${OPTARR[$i]}="
fi
fi
fi
done
# If none found, exit
if [ $OPTION = 'none' ]; then
echo "Invalid option $3 $4"
exit
fi
# Print out the new configuration file
while read LINE; do
if [[ $LINE =~ $OPTION ]]; then
OUTPUTRC="${OUTPUTRC}${OPTION}${4}\n"
else
OUTPUTRC="${OUTPUTRC}${LINE}\n"
fi
done < $RCFILE
printf $OUTPUTRC > $RCFILE
exit 0