brother-dcp197c-cupswrapper: modified to made it work
This commit is contained in:
parent
35a7d61085
commit
95ca7b39e2
5 changed files with 128 additions and 117 deletions
|
@ -1,6 +1,6 @@
|
||||||
case "${ACTION}" in
|
case "${ACTION}" in
|
||||||
post)
|
post)
|
||||||
/opt/brother/Printers/dcp197c/cupswrapper/brother_cupswrapper.void -i
|
/opt/brother/Printers/dcp197c/cupswrapper/cupswrapper.void -i
|
||||||
chmod 755 /opt/brother/Printers/dcp197c/cupswrapper
|
chmod 755 /opt/brother/Printers/dcp197c/cupswrapper
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
case ${ACTION} in
|
case ${ACTION} in
|
||||||
purge) /opt/brother/Printers/dcp197c/cupswrapper/brother_cupswrapper.void -e ;;
|
pre) /opt/brother/Printers/dcp197c/cupswrapper/cupswrapper.void -e ;;
|
||||||
esac
|
esac
|
||||||
|
|
21
srcpkgs/brother-dcp197c-cupswrapper/files/43-cups-usb.rules
Normal file
21
srcpkgs/brother-dcp197c-cupswrapper/files/43-cups-usb.rules
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# This file is installed by brother-XXXX-cupswrapper
|
||||||
|
# To adapt it to you needing make sure you:
|
||||||
|
# install usb-utils package
|
||||||
|
# launch lsusb and note a line resemblig this one:
|
||||||
|
#
|
||||||
|
# Bus 004 Device 007: ID 04f9:023e Brother Industries, Ltd
|
||||||
|
# Explanation:
|
||||||
|
#
|
||||||
|
# Bus xxx Device xxx are the location of the usb port
|
||||||
|
#
|
||||||
|
# ID 04f9:xxxx Brother Industries, Ltd
|
||||||
|
#
|
||||||
|
# note the xxxx hex number and put it in the field:
|
||||||
|
#
|
||||||
|
# ATTR{idProduct}=="023e" at place of 023e (the code for DCP197C)
|
||||||
|
#
|
||||||
|
# This is needed to make the printer work correctly
|
||||||
|
# even if you installed the brother-brsca3 package
|
||||||
|
# versione date 2014/04/26
|
||||||
|
|
||||||
|
ATTR{idVendor}=="04f9", ATTR{idProduct}=="023e", MODE:="0664", GROUP:="lp", ENV{libsane_matched}:="yes"
|
|
@ -18,33 +18,29 @@
|
||||||
# Place, Suite 330, Boston, MA 02111-1307 USA
|
# Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# modified for voidlinux by Carlo Dormeletti carlo.dormeletti <at> email.it
|
# modified for voidlinux by Carlo Dormeletti carlo.dormeletti <at> email.it
|
||||||
|
# modify date 2014/04/26
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
printer_model=""dcp197c""
|
printer_model=""dcp197c""
|
||||||
printer_name=`echo $printer_model | tr '[a-z]' '[A-Z]'`
|
cups_printer_name=`echo $printer_model | tr '[a-z]' '[A-Z]'`
|
||||||
device_name=`echo $printer_name | eval sed -e 's/MFC/MFC-/' -e 's/DCP/DCP-/' -e 's/FAX/FAX-/'`
|
device_name=`echo $cups_printer_name | eval sed -e 's/MFC/MFC-/' -e 's/DCP/DCP-/' -e 's/FAX/FAX-/'`
|
||||||
pcfilename=`echo $printer_name | tr -d '[A-Z]'`
|
# pcfilename=`echo $cups_printer_name | tr -d '[A-Z]'`
|
||||||
device_model="Printers"
|
device_model="Printers"
|
||||||
tmp_filter=/var/tmp/brlpdwrapper${printer_model}
|
tmp_filter=/var/tmp/brlpdwrapper${printer_model}
|
||||||
ppd_file_name=/usr/share/ppd/cupsfilters/brother_${printer_model}_printer_en.ppd
|
ppd_file_name=/usr/share/ppd/cupsfilters/brother_${printer_model}_printer_en.ppd
|
||||||
|
brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapper${printer_model}
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "-c" ]; then
|
if [ "$1" = "-c" ]; then
|
||||||
echo "printer_model => "
|
echo "---------- Printer ----------"
|
||||||
echo $printer_model
|
echo "printer_model => " $printer_model
|
||||||
echo "printer_name => "
|
echo "cups_printer_name => " $cups_printer_name
|
||||||
echo $printer_name
|
echo "device_name => " $device_name
|
||||||
echo "device_name => "
|
echo "device_model => " $device_model
|
||||||
echo $device_name
|
echo "-------- Filters File --------"
|
||||||
echo "pcfilename =>"
|
echo "tmp_filter => " $tmp_filter
|
||||||
echo $pcfilename
|
echo "ppd_file_name => " $ppd_file_name
|
||||||
echo "device_model => "
|
|
||||||
echo $device_model
|
|
||||||
echo "tmp_filter => "
|
|
||||||
echo $tmp_filter
|
|
||||||
echo "ppd_file_name => "
|
|
||||||
echo $ppd_file_name
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -52,27 +48,19 @@ fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = '-e' ]; then
|
if [ "$1" = '-e' ]; then
|
||||||
lpadmin -x ${printer_name}
|
lpadmin -x ${cups_printer_name}
|
||||||
rm -f $ppd_file_name
|
rm -f $ppd_file_name
|
||||||
|
rm -f $brotherlpdwrapper
|
||||||
|
|
||||||
#if [ -e /etc/init.d/cups ]; then
|
systemctl restart cups
|
||||||
# /etc/init.d/cups restart
|
exit 0
|
||||||
#elif [ -e /etc/init.d/cupsys ]; then
|
|
||||||
# /etc/init.d/cupsys restart
|
|
||||||
#fi
|
|
||||||
# /etc/init.d/cups restart
|
|
||||||
# exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "-r" ]; then
|
if [ "$1" = "-r" ]; then
|
||||||
lpadmin -x ${printer_name}
|
lpadmin -x ${cups_printer_name}
|
||||||
#if [ -e /etc/init.d/cups ]; then
|
|
||||||
# /etc/init.d/cups restart
|
systemctl restart cups
|
||||||
#elif [ -e /etc/init.d/cupsys ]; then
|
exit 0
|
||||||
# /etc/init.d/cupsys restart
|
|
||||||
#fi
|
|
||||||
# /etc/init.d/cups restart
|
|
||||||
# exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,6 +77,7 @@ if [ -e "/opt/brother/${device_model}/${printer_model}/lpd/filter${printer_model
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "ERROR : Brother LPD filter is not installed."
|
echo "ERROR : Brother LPD filter is not installed."
|
||||||
|
echo "ERROR : please install it."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +110,7 @@ cat <<!ENDOFWFILTER! >$tmp_filter
|
||||||
# Place, Suite 330, Boston, MA 02111-1307 USA
|
# Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# modified for voidlinux by Carlo Dormeletti carlo.dormeletti <at> email.it
|
# modified for voidlinux by Carlo Dormeletti carlo.dormeletti <at> email.it
|
||||||
|
# modify date 201/04/26
|
||||||
#
|
#
|
||||||
|
|
||||||
LOGFILE="/dev/null"
|
LOGFILE="/dev/null"
|
||||||
|
@ -209,6 +199,7 @@ else
|
||||||
cat > \$INPUT_TEMP_PS
|
cat > \$INPUT_TEMP_PS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "/opt/brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
|
if [ -e "/opt/brother/${device_model}/${printer_model}/lpd/filter${printer_model}" ]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
|
@ -221,9 +212,9 @@ CUPSOPTION=\`echo "\$5 Copies=\$4" | sed -e 's/BrMirror=OFF/MirrorPrint=OFF/' -e
|
||||||
|
|
||||||
if [ -e "/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
|
if [ -e "/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1" ]; then
|
||||||
if [ \$DEBUG = 0 ]; then
|
if [ \$DEBUG = 0 ]; then
|
||||||
/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
|
/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${cups_printer_name} \$PPDC 0 "\$CUPSOPTION" "${printer_model}">> /dev/null
|
||||||
else
|
else
|
||||||
/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
|
/opt/brother/${device_model}/${printer_model}/cupswrapper/brcupsconfpt1 ${cups_printer_name} \$PPDC \$LOGCLEVEL "\$CUPSOPTION" "${printer_model}">>\$LOGFILE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -238,6 +229,7 @@ if [ \$DEBUG -lt 10 ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f \$INPUT_TEMP_PS
|
rm -f \$INPUT_TEMP_PS
|
||||||
|
|
||||||
exit $errorcode
|
exit $errorcode
|
||||||
|
@ -247,10 +239,10 @@ exit $errorcode
|
||||||
chmod 755 $tmp_filter
|
chmod 755 $tmp_filter
|
||||||
|
|
||||||
#
|
#
|
||||||
# check /usr/lib/cups/filter
|
# check brotherlpdwrapper in /usr/lib/cups/filter
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ -d /usr/lib/cups/filter ]; then
|
if [ -d /usr/lib/cups/filter ]; then
|
||||||
brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapper${printer_model}
|
|
||||||
rm -f $brotherlpdwrapper
|
rm -f $brotherlpdwrapper
|
||||||
cp $tmp_filter $brotherlpdwrapper
|
cp $tmp_filter $brotherlpdwrapper
|
||||||
fi
|
fi
|
||||||
|
@ -258,19 +250,15 @@ fi
|
||||||
#
|
#
|
||||||
# remove temporary script file
|
# remove temporary script file
|
||||||
#
|
#
|
||||||
|
|
||||||
rm -f $tmp_filter
|
rm -f $tmp_filter
|
||||||
|
|
||||||
chmod a+w /opt/brother/${device_model}/${printer_model}/inf/br${printer_model}rc
|
chmod a+w /opt/brother/${device_model}/${printer_model}/inf/br${printer_model}rc
|
||||||
chmod a+w /opt/brother/${device_model}/${printer_model}/inf
|
chmod a+w /opt/brother/${device_model}/${printer_model}/inf
|
||||||
|
|
||||||
#if [ -e /etc/init.d/cups ]; then
|
|
||||||
# /etc/init.d/cups restart
|
|
||||||
#elif [ -e /etc/init.d/cupsys ]; then
|
|
||||||
# /etc/init.d/cupsys restart
|
|
||||||
#fi
|
|
||||||
|
|
||||||
sleep 2s
|
sleep 2s
|
||||||
|
|
||||||
|
systemctl restart cups
|
||||||
|
|
||||||
port2=`lpinfo -v | grep -i 'usb://Brother/${device_name}' | head -1`
|
port2=`lpinfo -v | grep -i 'usb://Brother/${device_name}' | head -1`
|
||||||
|
|
||||||
|
@ -288,7 +276,7 @@ if [ "$port" = '' ];then
|
||||||
port=usb:/dev/usb/lp0
|
port=usb:/dev/usb/lp0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lpadmin -p ${printer_name} -E -v $port -P $ppd_file_name
|
lpadmin -p ${cups_printer_name} -E -v $port -P $ppd_file_name
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'brother-dcp197c-cupswrapper'
|
# Template file for 'brother-dcp197c-cupswrapper'
|
||||||
pkgname=brother-dcp197c-cupswrapper
|
pkgname=brother-dcp197c-cupswrapper
|
||||||
version=1.1.3
|
version=1.1.3
|
||||||
revision=2
|
revision=3
|
||||||
maintainer="Carlo Dormeletti <carlo.dormeletti@email.it>"
|
maintainer="Carlo Dormeletti <carlo.dormeletti@email.it>"
|
||||||
homepage="http://support.brother.com/g/b/index.aspx"
|
homepage="http://support.brother.com/g/b/index.aspx"
|
||||||
license="GPL-2"
|
license="GPL-2"
|
||||||
|
@ -19,5 +19,7 @@ do_extract() {
|
||||||
do_install(){
|
do_install(){
|
||||||
mkdir -p ${DESTDIR}
|
mkdir -p ${DESTDIR}
|
||||||
tar xzpvf data.tar.gz -C ${DESTDIR}
|
tar xzpvf data.tar.gz -C ${DESTDIR}
|
||||||
vinstall ${FILESDIR}/brother_cupswrapper.void 755 /opt/brother/Printers/dcp197c/cupswrapper/
|
rm ${DESTDIR}/opt/brother/Printers/dcp197c/cupswrapper/cupswrapperdcp197c
|
||||||
|
vinstall ${FILESDIR}/cupswrapper.void 755 /opt/brother/Printers/dcp197c/cupswrapper/
|
||||||
|
vinstall ${FILESDIR}/43-cups-usb.rules 644 /usr/lib/udev/rules.d/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue