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/HL5240.ppd
24
rm -f /usr/lib/cups/filter/brlpdwrapperHL5240
25
rm -f /usr/lib64/cups/filter/brlpdwrapperHL5240
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/filterHL5240" ]; then
58
echo "ERROR : Brother LPD filter is not installed."
60
rm -f /usr/share/cups/model/HL5240.ppd
61
ppd_file_name=/usr/share/cups/model/HL5240.ppd
63
cat <<ENDOFPPDFILE >$ppd_file_name
65
*%================================================
66
*% Copyright(C) 2006 Brother Industries, Ltd.
67
*% "Brother HL5240 for CUPS"
68
*%================================================
70
*%==== General Information Keywords ========================
73
*LanguageEncoding: ISOLatin1
74
*LanguageVersion: English
75
*Manufacturer: "Brother"
76
*PCFileName: "HL5240.PPD"
77
*Product: "(Brother HL5240 series)"
79
*cupsManualCopies: True
81
*cupsFilter: "application/vnd.cups-postscript 0 brlpdwrapperHL5240"
82
*PSVersion: "(3010.106) 3"
84
*NickName: "Brother HL5240 for CUPS"
85
*ShortNickName: "Brother HL5240 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
*OpenGroup: InstallableOptions/Options Installed
116
*OpenUI *OptionTrays/Number of Input Trays: PickOne
117
*DefaultOptionTrays: 2Trays
118
*OptionTrays 1Trays/ 1: ""
119
*OptionTrays 2Trays/ 2: ""
120
*OptionTrays 3Trays/ 3: ""
123
<</BRFeeder 1>>setpagedevice currentpagedevice/BRFeeder get
124
1 eq{(2Trays)}{(1Trays)}ifelse
129
*CloseUI: *OptionTrays
131
*CloseGroup: InstallableOptions
133
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray2
134
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray3
135
*UIConstraints: *OptionTrays 1Trays *InputSlot Tray4
136
*UIConstraints: *OptionTrays 2Trays *InputSlot Tray3
137
*UIConstraints: *OptionTrays 2Trays *InputSlot Tray4
138
*UIConstraints: *OptionTrays 3Trays *InputSlot Tray4
140
*%==== Media Selection ======================
142
*OpenUI *PageSize: PickOne
143
*OrderDependency: 30 AnySetup *PageSize
145
*PageSize Letter/Letter: " "
146
*PageSize Legal/Legal: " "
147
*PageSize Executive/Executive: " "
151
*PageSize Env10/Com-10: " "
152
*PageSize EnvMonarch/Monarch: " "
153
*PageSize EnvDL/DL: " "
154
*PageSize EnvC5/C5: " "
155
*PageSize EnvISOB5/B5: " "
156
*PageSize EnvISOB6/B6: " "
159
*OpenUI *PageRegion: PickOne
160
*OrderDependency: 40 AnySetup *PageRegion
161
*DefaultPageRegion: A4
162
*PageRegion Letter/Letter: " "
163
*PageRegion Legal/Legal: " "
164
*PageRegion Executive/Executive: " "
165
*PageRegion A4/A4: " "
166
*PageRegion A5/A5: " "
167
*PageRegion A6/A6: " "
168
*PageRegion Env10/Com-10: " "
169
*PageRegion EnvMonarch/Monarch: " "
170
*PageRegion EnvDL/DL: " "
171
*PageRegion EnvC5/C5: " "
172
*PageRegion EnvISOB5/B5: " "
173
*PageRegion EnvISOB6/B6: " "
174
*CloseUI: *PageRegion
176
*DefaultImageableArea: A4
177
*ImageableArea Letter/Letter: "18 12 594 780"
178
*ImageableArea Legal/Legal: "18 12 594 996"
179
*ImageableArea Executive/Executive: "18 12 504 744"
180
*ImageableArea A4/A4: "18 12 577 830"
181
*ImageableArea A5/A5: "18 12 403 583"
182
*ImageableArea A6/A6: "18 12 279 408"
183
*ImageableArea Env10/Com-10: "18 12 279 672"
184
*ImageableArea EnvMonarch/Monarch: "18 12 261 528"
185
*ImageableArea EnvDL/DL: "18 12 294 612"
186
*ImageableArea EnvC5/C5: "18 12 441 637"
187
*ImageableArea EnvISOB5/B5: "18 12 463 697"
188
*ImageableArea EnvISOB6/B6: "18 12 336 487"
190
*%==== Information About Media Sizes ========
192
*DefaultPaperDimension: A4
193
*PaperDimension Letter/Letter: "612 792"
194
*PaperDimension Legal/Legal: "612 1008"
195
*PaperDimension Executive/Executive: "522 756"
196
*PaperDimension A4/A4: "595 842"
197
*PaperDimension A5/A5: "420 595"
198
*PaperDimension A6/A6: "297 420"
199
*PaperDimension Env10/Com-10: "297 684"
200
*PaperDimension EnvMonarch/Monarch: "279 540"
201
*PaperDimension EnvDL/DL: "312 624"
202
*PaperDimension EnvC5/C5: "459 649"
203
*PaperDimension EnvISOB5/B5: "499 709"
204
*PaperDimension EnvISOB6/B6: "354 499"
206
*%==== 5.13 Media Handling Features ============================
207
*OpenUI *BrMediaType/BrMediaType: PickOne
208
*OrderDependency: 28 AnySetup *BrMediaType
209
*DefaultBrMediaType: PLAIN
210
*BrMediaType PLAIN/Plain Paper: " "
211
*BrMediaType THIN/Thin Paper: " "
212
*BrMediaType THICK/Thick Paper: " "
213
*BrMediaType THICKERPAPER2/Thicker Paper: " "
214
*BrMediaType BOND/Bond Paper: " "
215
*BrMediaType TRANSPARENCIES/Transparencies: " "
216
*BrMediaType ENV/Envelopes: " "
217
*BrMediaType ENVTHICK/Env. Thick: " "
218
*BrMediaType ENVTHIN/Env. Thin: " "
219
*CloseUI: *BrMediaType
221
*OpenUI *InputSlot/InputSlot: PickOne
222
*OrderDependency: 29 AnySetup *InputSlot
223
*DefaultInputSlot: AUTO
224
*InputSlot MANUAL/Manual Feed: " "
225
*InputSlot MPTRAY/MP Tray: " "
226
*InputSlot TRAY1/Tray1: " "
227
*InputSlot TRAY2/Tray2: " "
228
*InputSlot TRAY3/Tray3: " "
229
*InputSlot AUTO/Auto Select: " "
232
*RequiresPageRegion All:True
235
*%=== Duplex ================================
236
*%=== Output Bin =============================
237
*% === Collate ==========
238
*%==== 5.14 Finishing Features =================================
239
*%%%%% Resolution and Appearance Control %%%%%
240
*OpenUI *Resolution: PickOne
241
*OrderDependency: 11 AnySetup *Resolution
242
*DefaultResolution: 600dpi
243
*Resolution 300dpi: " "
244
*Resolution 600dpi: " "
245
*Resolution 2400x600dpi/HQ1200dpi: " "
246
*Resolution 1200dpi: " "
247
*CloseUI: *Resolution
249
*OpenUI *TonerSaveMode/Toner Save: PickOne
250
*DefaultTonerSaveMode: Off
251
*OrderDependency: 10 AnySetup *TonerSaveMode
252
*TonerSaveMode Off/Off: "statusdict begin false tonersave end"
253
*TonerSaveMode On/On: "statusdict begin true tonersave end"
254
*CloseUI: *TonerSaveMode
256
*OpenUI *Sleep/Sleep Time [Min.]: PickOne
257
*DefaultSleep: PrinterDefault
258
*OrderDependency: 10 AnySetup *Sleep
259
*Sleep PrinterDefault/Printer Default: ""
260
*Sleep 2minutes/2: "statusdict begin 2 powersavetime end"
261
*Sleep 10minutes/10: "statusdict begin 10 powersavetime end"
262
*Sleep 30minutes/30: "statusdict begin 30 powersavetime end"
265
*%==== 5.20 Font Related Keywords ==============================
266
*DefaultFont: Courier
267
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
268
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
269
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
270
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
271
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
272
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
273
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
274
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
275
*Font Courier: Standard "(002.004S)" Standard ROM
276
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
277
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
278
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
279
*Font Helvetica: Standard "(001.006S)" Standard ROM
280
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
281
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
282
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
283
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
284
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
285
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
286
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
287
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
288
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
289
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
290
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
291
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
292
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
293
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
294
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
295
*Font Times-Bold: Standard "(001.007S)" Standard ROM
296
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
297
*Font Times-Italic: Standard "(001.007S)" Standard ROM
298
*Font Times-Roman: Standard "(001.007S)" Standard ROM
299
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
300
*Font ZapfDingbats: Special "(001.004S)" Special ROM
301
*Font Symbol: Special "(001.007S)" Special ROM
302
*Font Alaska: Standard "(001.005)" Standard ROM
303
*Font AlaskaExtrabold: Standard "(001.005)" Standard ROM
304
*Font AntiqueOakland: Standard "(001.005)" Standard ROM
305
*Font AntiqueOakland-Bold: Standard "(001.005)" Standard ROM
306
*Font AntiqueOakland-Oblique: Standard "(001.005)" Standard ROM
307
*Font ClevelandCondensed: Standard "(001.005)" Standard ROM
308
*Font Connecticut: Standard "(001.005)" Standard ROM
309
*Font Guatemala-Antique: Standard "(001.005)" Standard ROM
310
*Font Guatemala-Bold: Standard "(001.005)" Standard ROM
311
*Font Guatemala-Italic: Standard "(001.005)" Standard ROM
312
*Font Guatemala-BoldItalic: Standard "(001.005)" Standard ROM
313
*Font LetterGothic: Standard "(001.005)" Standard ROM
314
*Font LetterGothic-Bold: Standard "(001.005)" Standard ROM
315
*Font LetterGothic-Oblique: Standard "(001.005)" Standard ROM
316
*Font Maryland: Standard "(001.005)" Standard ROM
317
*Font Oklahoma: Standard "(001.005)" Standard ROM
318
*Font Oklahoma-Bold: Standard "(001.005)" Standard ROM
319
*Font Oklahoma-Oblique: Standard "(001.005)" Standard ROM
320
*Font Oklahoma-BoldOblique: Standard "(001.005)" Standard ROM
321
*Font Utah: Standard "(001.005)" Standard ROM
322
*Font Utah-Bold: Standard "(001.005)" Standard ROM
323
*Font Utah-Oblique: Standard "(001.005)" Standard ROM
324
*Font Utah-BoldOblique: Standard "(001.005)" Standard ROM
325
*Font UtahCondensed: Standard "(001.005)" Standard ROM
326
*Font UtahCondensed-Bold: Standard "(001.005)" Standard ROM
327
*Font UtahCondensed-Oblique: Standard "(001.004)" Standard ROM
328
*Font UtahCondensed-BoldOblique: Standard "(001.005)" Standard ROM
329
*Font BermudaScript: Standard "(001.005)" Standard ROM
330
*Font Germany: Standard "(001.005)" Standard ROM
331
*Font SanDiego: Standard "(001.005)" Standard ROM
332
*Font US-Roman: Standard "(001.005)" Standard ROM
337
=string cvs (/) print print (:) print
338
FontDirectory exch known
340
{(fonts/)AppendName exch pop mark exch
341
{}=string filenameforall counttomark
344
{cleartomark(No)}ifelse
354
FontDirectory{pop ==}forall
356
{dup length 6 sub 6 exch getinterval cvn ==
357
}=string filenameforall
367
brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperHL5240
368
brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperHL5240
369
rm -f $brotherlpdwrapper
372
cat <<!ENDOFWFILTER! >$brotherlpdwrapper
375
# Brother Print filter >> $brotherlpdwrapper
376
# Copyright (C) 2005 Brother. Industries, Ltd.
379
# This program is free software; you can redistribute it and/or modify it
380
# under the terms of the GNU General Public License as published by the Free
381
# Software Foundation; either version 2 of the License, or (at your option)
384
# This program is distributed in the hope that it will be useful, but WITHOUT
385
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
386
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
389
# You should have received a copy of the GNU General Public License along with
390
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
391
# Place, Suite 330, Boston, MA 02111-1307 USA
402
if [ "\`echo \$5 | grep 'debug-noprint=1'\`" != '' ]; then
405
if [ "\`echo \$5 | grep 'debug-noprint=2'\`" != '' ]; then
408
if [ "\`echo \$5 | grep 'debug-noprint=3'\`" != '' ]; then
411
if [ \$DEBUG != 0 ]; then
412
LOGFILE=/tmp/br_cupsfilter_debug_log
418
if [ "\$PPD" = "" ]; then
419
PPD="/usr/share/cups/model/HL5240.ppd"
423
if [ \$LOGFILE != "/dev/null" ]; then
424
if [ \$LOG_LATESTONLY == "1" ]; then
428
if [ -e \$LOGFILE ]; then
434
echo "arg0 = \$0" >>\$LOGFILE
435
echo "arg1 = \$1" >>\$LOGFILE
436
echo "arg2 = \$2" >>\$LOGFILE
437
echo "arg3 = \$3" >>\$LOGFILE
438
echo "arg4 = \$4" >>\$LOGFILE
439
echo "arg5 = \$5" >>\$LOGFILE
440
echo "arg6 = \$6" >>\$LOGFILE
441
echo "PPD = \$PPD" >>\$LOGFILE
444
INPUT_TEMP_PS=\`mktemp /tmp/br_input_ps.XXXXXX\`
447
if [ "\`echo \$5 | grep 'Nup='\`" != '' ] && [ \$NUPENABLE != 0 ]; then
449
if [ "\`echo \$5 | grep 'Nup=64'\`" != '' ]; then
451
elif [ "\`echo \$5 | grep 'Nup=32'\`" != '' ]; then
453
elif [ "\`echo \$5 | grep 'Nup=25'\`" != '' ]; then
455
elif [ "\`echo \$5 | grep 'Nup=16'\`" != '' ]; then
457
elif [ "\`echo \$5 | grep 'Nup=8'\`" != '' ]; then
459
elif [ "\`echo \$5 | grep 'Nup=6'\`" != '' ]; then
461
elif [ "\`echo \$5 | grep 'Nup=4'\`" != '' ]; then
463
elif [ "\`echo \$5 | grep 'Nup=2'\`" != '' ]; then
465
elif [ "\`echo \$5 | grep 'Nup=1'\`" != '' ]; then
468
echo "NUP=\$nup" >>\$LOGFILE
469
if [ -e /usr/bin/psnup ]; then
470
if [ \$# -ge 7 ]; then
471
cat \$6 | \$nup > \$INPUT_TEMP_PS
473
cat | \$nup > \$INPUT_TEMP_PS
476
if [ \$# -ge 7 ]; then
477
cp \$6 \$INPUT_TEMP_PS
479
cat > \$INPUT_TEMP_PS
483
if [ \$# -ge 7 ]; then
484
cp \$6 \$INPUT_TEMP_PS
486
cat > \$INPUT_TEMP_PS
490
if [ "\$ENABLECOPY" != 0 ];then
491
if [ "\$4" -ge 2 ];then
492
options="\$5"" ""Copies=\$4"
501
if [ -e "/usr/local/Brother/lpd/filter\$PRINTER" ]; then
504
echo "ERROR: /usr/local/Brother/lpd/filter\$PRINTER does not exist" >>\$LOGFILE
509
if [ -e "/usr/local/Brother/cupswrapper/brcupsconfig3" ]; then
510
if [ \$DEBUG = 0 ]; then
511
/usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD 0 "\$options" >> /dev/null
513
/usr/local/Brother/cupswrapper/brcupsconfig3 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE
518
if [ \$DEBUG -le 2 ]; then
519
cat \$INPUT_TEMP_PS | /usr/local/Brother/lpd/filter\$PRINTER
522
if [ \$DEBUG -ge 2 ]; then
523
if [ \$LOGFILE != "/dev/null" ]; then
525
echo " ------PostScript Data-------" >>\$LOGFILE
526
cat \$INPUT_TEMP_PS >>\$LOGFILE
529
rm -f \$INPUT_TEMP_PS
536
chmod a+x $brotherlpdwrapper
537
if [ -e /usr/lib64/cups/filter ]; then
538
cp $brotherlpdwrapper $brotherlpdwrapper64
541
chmod a+w /usr/local/Brother/inf/brHL5240rc
542
chmod a+w /usr/local/Brother/inf
543
if [ -e /etc/init.d/lpd ]; then
546
if [ -e /etc/init.d/lprng ]; then
547
/etc/init.d/lprng stop
549
if [ -e /etc/init.d/cups ]; then
550
/etc/init.d/cups restart
552
if [ -e /etc/init.d/cupsys ]; then
553
/etc/init.d/cupsys restart
556
port2=`lpinfo -v | grep -i 'usb://Brother/HL-5240' | head -1`
557
if [ "$port2" = '' ];then
558
port2=`lpinfo -v | grep 'usb://' | head -1`
560
port=`echo $port2| sed s/direct//g`
561
if [ "$port" = '' ];then
562
port=usb:/dev/usb/lp0
564
lpadmin -p HL5240 -E -v $port -P /usr/share/cups/model/HL5240.ppd