4
# Copyright (C) 2005 Brother. Industries, Ltd.
6
# This program is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by the Free
8
# Software Foundation; either version 2 of the License, or (at your option)
11
# This program is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
# You should have received a copy of the GNU General Public License along with
17
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18
# Place, Suite 330, Boston, MA 02111-1307 USA
21
if [ "$1" = '-e' ]; then
23
rm -f /usr/share/cups/model/FAX2920.ppd
24
rm -f /usr/lib/cups/filter/brlpdwrapperFAX2920
25
rm -f /usr/lib64/cups/filter/brlpdwrapperFAX2920
26
rm -f /usr/local/Brother/cupswrapper/brcupsconfig3
27
if [ -e /etc/init.d/cups ]; then
28
/etc/init.d/cups restart
30
if [ -e /etc/init.d/cupsys ]; then
31
/etc/init.d/cupsys restart
35
if [ "$1" = "-r" ]; then
37
if [ -e /etc/init.d/cups ]; then
38
/etc/init.d/cups restart
40
if [ -e /etc/init.d/cupsys ]; then
41
/etc/init.d/cupsys restart
45
if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
46
echo 'option -h : help'
48
echo ' -e : uninstall'
49
echo ' -r : remove printer'
52
mkdir -p /usr/local/Brother/filter
53
mkdir -p /usr/lib/cups/filter
55
if [ -e "/usr/local/Brother/lpd/filterFAX2920" ]; then
58
echo "ERROR : Brother LPD filter is not installed."
60
rm -f /usr/share/cups/model/FAX2920.ppd
61
ppd_file_name=/usr/share/cups/model/FAX2920.ppd
63
cat <<ENDOFPPDFILE >$ppd_file_name
65
*%================================================
66
*% Copyright(C) 2006 Brother Industries, Ltd.
67
*% "Brother FAX2920 for CUPS"
68
*%================================================
70
*%==== General Information Keywords ========================
73
*LanguageEncoding: ISOLatin1
74
*LanguageVersion: English
75
*Manufacturer: "Brother"
76
*PCFileName: "FAX2920.PPD"
77
*Product: "(Brother FAX2920 series)"
79
*cupsManualCopies: True
81
*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperFAX2920"
82
*PSVersion: "(3010.106) 3"
84
*NickName: "Brother FAX2920 for CUPS"
85
*ShortNickName: "Brother FAX2920 for CUPS"
87
*%==== Basic Device Capabilities =============
91
*DefaultColorSpace: Gray
95
/devname (%disk0%) def
98
devname exch 48 add 5 exch put
100
0 ne {/ret true def}if
101
pop pop pop pop pop pop pop
104
ret {(True)}{(False)} ifelse = flush
112
*%==== Installable Options ===================
114
*%==== Media Selection ======================
116
*OpenUI *PageSize: PickOne
117
*OrderDependency: 30 AnySetup *PageSize
119
*PageSize Letter/Letter: " "
120
*PageSize Legal/Legal: " "
121
*PageSize Executive/Executive: " "
125
*PageSize Env10/Com-10: " "
126
*PageSize EnvMonarch/Monarch: " "
127
*PageSize EnvDL/DL: " "
128
*PageSize EnvC5/C5: " "
129
*PageSize EnvISOB5/B5: " "
130
*PageSize EnvISOB6/B6: " "
133
*OpenUI *PageRegion: PickOne
134
*OrderDependency: 40 AnySetup *PageRegion
135
*DefaultPageRegion: A4
136
*PageRegion Letter/Letter: " "
137
*PageRegion Legal/Legal: " "
138
*PageRegion Executive/Executive: " "
139
*PageRegion A4/A4: " "
140
*PageRegion A5/A5: " "
141
*PageRegion A6/A6: " "
142
*PageRegion Env10/Com-10: " "
143
*PageRegion EnvMonarch/Monarch: " "
144
*PageRegion EnvDL/DL: " "
145
*PageRegion EnvC5/C5: " "
146
*PageRegion EnvISOB5/B5: " "
147
*PageRegion EnvISOB6/B6: " "
148
*CloseUI: *PageRegion
150
*DefaultImageableArea: A4
151
*ImageableArea Letter/Letter: "18 12 594 780"
152
*ImageableArea Legal/Legal: "18 12 594 996"
153
*ImageableArea Executive/Executive: "18 12 504 744"
154
*ImageableArea A4/A4: "18 12 577 830"
155
*ImageableArea A5/A5: "18 12 403 583"
156
*ImageableArea A6/A6: "18 12 279 408"
157
*ImageableArea Env10/Com-10: "18 12 279 672"
158
*ImageableArea EnvMonarch/Monarch: "18 12 261 528"
159
*ImageableArea EnvDL/DL: "18 12 294 612"
160
*ImageableArea EnvC5/C5: "18 12 441 637"
161
*ImageableArea EnvISOB5/B5: "18 12 463 697"
162
*ImageableArea EnvISOB6/B6: "18 12 336 487"
164
*%==== Information About Media Sizes ========
166
*DefaultPaperDimension: A4
167
*PaperDimension Letter/Letter: "612 792"
168
*PaperDimension Legal/Legal: "612 1008"
169
*PaperDimension Executive/Executive: "522 756"
170
*PaperDimension A4/A4: "595 842"
171
*PaperDimension A5/A5: "420 595"
172
*PaperDimension A6/A6: "297 420"
173
*PaperDimension Env10/Com-10: "297 684"
174
*PaperDimension EnvMonarch/Monarch: "279 540"
175
*PaperDimension EnvDL/DL: "312 624"
176
*PaperDimension EnvC5/C5: "459 649"
177
*PaperDimension EnvISOB5/B5: "499 709"
178
*PaperDimension EnvISOB6/B6: "354 499"
180
*%==== 5.13 Media Handling Features ============================
181
*OpenUI *BrMediaType/BrMediaType: PickOne
182
*OrderDependency: 28 AnySetup *BrMediaType
183
*DefaultBrMediaType: PLAIN
184
*BrMediaType PLAIN/Plain Paper: " "
185
*BrMediaType THIN/Thin Paper: " "
186
*BrMediaType THICK/Thick Paper: " "
187
*BrMediaType THICKERPAPER2/Thicker Paper: " "
188
*BrMediaType BOND/Bond Paper: " "
189
*BrMediaType TRANSPARENCIES/Transparencies: " "
190
*BrMediaType ENV/Envelopes: " "
191
*BrMediaType ENVTHICK/Env. Thick: " "
192
*BrMediaType ENVTHIN/Env. Thin: " "
193
*CloseUI: *BrMediaType
195
*OpenUI *InputSlot/InputSlot: PickOne
196
*OrderDependency: 29 AnySetup *InputSlot
197
*DefaultInputSlot: TRAY1
198
*InputSlot MANUAL/Manual Feed: " "
199
*InputSlot TRAY1/Tray1: " "
202
*RequiresPageRegion All:True
205
*%=== Duplex ================================
206
*%=== Output Bin =============================
207
*% === Collate ==========
208
*%==== 5.14 Finishing Features =================================
209
*%%%%% Resolution and Appearance Control %%%%%
210
*OpenUI *Resolution: PickOne
211
*OrderDependency: 11 AnySetup *Resolution
212
*DefaultResolution: 600dpi
213
*Resolution 300dpi: " "
214
*Resolution 600dpi: " "
215
*Resolution 1200x600dpi/HQ1200dpi: " "
216
*CloseUI: *Resolution
218
*OpenUI *TonerSaveMode/Toner Save: PickOne
219
*DefaultTonerSaveMode: Off
220
*OrderDependency: 10 AnySetup *TonerSaveMode
221
*TonerSaveMode Off/Off: "statusdict begin false tonersave end"
222
*TonerSaveMode On/On: "statusdict begin true tonersave end"
223
*CloseUI: *TonerSaveMode
225
*OpenUI *Sleep/Sleep Time [Min.]: PickOne
226
*DefaultSleep: PrinterDefault
227
*OrderDependency: 10 AnySetup *Sleep
228
*Sleep PrinterDefault/Printer Default: ""
229
*Sleep 2minutes/2: "statusdict begin 2 powersavetime end"
230
*Sleep 10minutes/10: "statusdict begin 10 powersavetime end"
231
*Sleep 30minutes/30: "statusdict begin 30 powersavetime end"
234
*%==== 5.20 Font Related Keywords ==============================
235
*DefaultFont: Courier
236
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
237
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
238
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
239
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
240
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
241
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
242
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
243
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
244
*Font Courier: Standard "(002.004S)" Standard ROM
245
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
246
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
247
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
248
*Font Helvetica: Standard "(001.006S)" Standard ROM
249
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
250
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
251
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
252
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
253
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
254
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
255
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
256
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
257
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
258
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
259
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
260
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
261
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
262
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
263
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
264
*Font Times-Bold: Standard "(001.007S)" Standard ROM
265
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
266
*Font Times-Italic: Standard "(001.007S)" Standard ROM
267
*Font Times-Roman: Standard "(001.007S)" Standard ROM
268
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
269
*Font ZapfDingbats: Special "(001.004S)" Special ROM
270
*Font Symbol: Special "(001.007S)" Special ROM
271
*Font Alaska: Standard "(001.005)" Standard ROM
272
*Font AlaskaExtrabold: Standard "(001.005)" Standard ROM
273
*Font AntiqueOakland: Standard "(001.005)" Standard ROM
274
*Font AntiqueOakland-Bold: Standard "(001.005)" Standard ROM
275
*Font AntiqueOakland-Oblique: Standard "(001.005)" Standard ROM
276
*Font ClevelandCondensed: Standard "(001.005)" Standard ROM
277
*Font Connecticut: Standard "(001.005)" Standard ROM
278
*Font Guatemala-Antique: Standard "(001.005)" Standard ROM
279
*Font Guatemala-Bold: Standard "(001.005)" Standard ROM
280
*Font Guatemala-Italic: Standard "(001.005)" Standard ROM
281
*Font Guatemala-BoldItalic: Standard "(001.005)" Standard ROM
282
*Font LetterGothic: Standard "(001.005)" Standard ROM
283
*Font LetterGothic-Bold: Standard "(001.005)" Standard ROM
284
*Font LetterGothic-Oblique: Standard "(001.005)" Standard ROM
285
*Font Maryland: Standard "(001.005)" Standard ROM
286
*Font Oklahoma: Standard "(001.005)" Standard ROM
287
*Font Oklahoma-Bold: Standard "(001.005)" Standard ROM
288
*Font Oklahoma-Oblique: Standard "(001.005)" Standard ROM
289
*Font Oklahoma-BoldOblique: Standard "(001.005)" Standard ROM
290
*Font Utah: Standard "(001.005)" Standard ROM
291
*Font Utah-Bold: Standard "(001.005)" Standard ROM
292
*Font Utah-Oblique: Standard "(001.005)" Standard ROM
293
*Font Utah-BoldOblique: Standard "(001.005)" Standard ROM
294
*Font UtahCondensed: Standard "(001.005)" Standard ROM
295
*Font UtahCondensed-Bold: Standard "(001.005)" Standard ROM
296
*Font UtahCondensed-Oblique: Standard "(001.004)" Standard ROM
297
*Font UtahCondensed-BoldOblique: Standard "(001.005)" Standard ROM
298
*Font BermudaScript: Standard "(001.005)" Standard ROM
299
*Font Germany: Standard "(001.005)" Standard ROM
300
*Font SanDiego: Standard "(001.005)" Standard ROM
301
*Font US-Roman: Standard "(001.005)" Standard ROM
306
=string cvs (/) print print (:) print
307
FontDirectory exch known
309
{(fonts/)AppendName exch pop mark exch
310
{}=string filenameforall counttomark
313
{cleartomark(No)}ifelse
323
FontDirectory{pop ==}forall
325
{dup length 6 sub 6 exch getinterval cvn ==
326
}=string filenameforall
336
brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperFAX2920
337
brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperFAX2920
338
rm -f $brotherlpdwrapper
341
cat <<!ENDOFWFILTER! >$brotherlpdwrapper
344
# Brother Print filter >> $brotherlpdwrapper
345
# Copyright (C) 2005 Brother. Industries, Ltd.
348
# This program is free software; you can redistribute it and/or modify it
349
# under the terms of the GNU General Public License as published by the Free
350
# Software Foundation; either version 2 of the License, or (at your option)
353
# This program is distributed in the hope that it will be useful, but WITHOUT
354
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
355
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
358
# You should have received a copy of the GNU General Public License along with
359
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
360
# Place, Suite 330, Boston, MA 02111-1307 USA
371
if [ "\`echo \$5 | grep 'debug-noprint=1'\`" != '' ]; then
374
if [ "\`echo \$5 | grep 'debug-noprint=2'\`" != '' ]; then
377
if [ "\`echo \$5 | grep 'debug-noprint=3'\`" != '' ]; then
380
if [ \$DEBUG != 0 ]; then
381
LOGFILE=/tmp/br_cupsfilter_debug_log
387
if [ "\$PPD" = "" ]; then
388
PPD="/usr/share/cups/model/FAX2920.ppd"
392
if [ \$LOGFILE != "/dev/null" ]; then
393
if [ \$LOG_LATESTONLY == "1" ]; then
397
if [ -e \$LOGFILE ]; then
403
echo "arg0 = \$0" >>\$LOGFILE
404
echo "arg1 = \$1" >>\$LOGFILE
405
echo "arg2 = \$2" >>\$LOGFILE
406
echo "arg3 = \$3" >>\$LOGFILE
407
echo "arg4 = \$4" >>\$LOGFILE
408
echo "arg5 = \$5" >>\$LOGFILE
409
echo "arg6 = \$6" >>\$LOGFILE
410
echo "PPD = \$PPD" >>\$LOGFILE
413
INPUT_TEMP_PS=\`mktemp /tmp/br_input_ps.XXXXXX\`
416
if [ "\`echo \$5 | grep 'Nup='\`" != '' ] && [ \$NUPENABLE != 0 ]; then
418
if [ "\`echo \$5 | grep 'Nup=64'\`" != '' ]; then
420
elif [ "\`echo \$5 | grep 'Nup=32'\`" != '' ]; then
422
elif [ "\`echo \$5 | grep 'Nup=25'\`" != '' ]; then
424
elif [ "\`echo \$5 | grep 'Nup=16'\`" != '' ]; then
426
elif [ "\`echo \$5 | grep 'Nup=8'\`" != '' ]; then
428
elif [ "\`echo \$5 | grep 'Nup=6'\`" != '' ]; then
430
elif [ "\`echo \$5 | grep 'Nup=4'\`" != '' ]; then
432
elif [ "\`echo \$5 | grep 'Nup=2'\`" != '' ]; then
434
elif [ "\`echo \$5 | grep 'Nup=1'\`" != '' ]; then
437
echo "NUP=\$nup" >>\$LOGFILE
438
if [ -e /usr/bin/psnup ]; then
439
if [ \$# -ge 7 ]; then
440
cat \$6 | \$nup > \$INPUT_TEMP_PS
442
cat | \$nup > \$INPUT_TEMP_PS
445
if [ \$# -ge 7 ]; then
446
cp \$6 \$INPUT_TEMP_PS
448
cat > \$INPUT_TEMP_PS
452
if [ \$# -ge 7 ]; then
453
cp \$6 \$INPUT_TEMP_PS
455
cat > \$INPUT_TEMP_PS
459
if [ "\$ENABLECOPY" != 0 ];then
460
if [ "\$4" -ge 2 ];then
461
options="\$5"" ""Copies=\$4"
470
if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
473
echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
478
if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
479
if [ \$DEBUG = 0 ]; then
480
/usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
482
/usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
487
if [ \$DEBUG -le 2 ]; then
488
cat \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
491
if [ \$DEBUG -ge 2 ]; then
492
if [ \$LOGFILE != "/dev/null" ]; then
494
echo " ------PostScript Data-------" >>\$LOGFILE
495
cat \$INPUT_TEMP_PS >>\$LOGFILE
498
rm -f \$INPUT_TEMP_PS
505
chmod a+x $brotherlpdwrapper
506
if [ -e /usr/lib64/cups/filter ]; then
507
cp $brotherlpdwrapper $brotherlpdwrapper64
510
chmod a+w /usr/local/Brother/inf/brFAX2920rc
511
chmod a+w /usr/local/Brother/inf
512
if [ -e /etc/init.d/lpd ]; then
515
if [ -e /etc/init.d/lprng ]; then
516
/etc/init.d/lprng stop
518
if [ -e /etc/init.d/cups ]; then
519
/etc/init.d/cups restart
521
if [ -e /etc/init.d/cupsys ]; then
522
/etc/init.d/cupsys restart
525
port2=`lpinfo -v | grep -i 'usb://Brother/FAX-2920' | head -1`
526
if [ "$port2" = '' ];then
527
port2=`lpinfo -v | grep 'usb://' | head -1`
529
port=`echo $port2| sed s/direct//g`
530
if [ "$port" = '' ];then
531
port=usb:/dev/usb/lp0
533
lpadmin -p FAX2920 -E -v $port -P /usr/share/cups/model/FAX2920.ppd