From c985806aa7870d27f541f422744cdee3ca30044c Mon Sep 17 00:00:00 2001 From: fabian-flechtmann Date: Wed, 5 Aug 2026 19:57:27 +0200 Subject: [PATCH] foo2ddst: fix Ricoh detection and job holding Add a default-off -H option that emits @PJL SET HOLD=OFF once per job, then select it for the Ricoh SP 112 and SP 201Nw through the Foomatic PrinterType mechanism. Record the USB identity captured from the SP 112 and regenerate both Ricoh PPDs from their XML sources. Preserve the SP 201Nw MFG and MDL DeviceID fields that current foomatic-db-engine derives from the printer make and model even without an autodetect block. Leave that model without a USB autodetect claim until its actual IEEE-1284 response is available. Regeneration also picks up the existing Auto media-source default. The regression test covers output with and without -H. Model scoping was verified manually with foomatic-rip so the test does not pin generated PPD text. --- Makefile | 16 +++++++- PPD/Ricoh-SP_112.ppd | 11 +++-- PPD/Ricoh-SP_201Nw.ppd | 7 +++- foo2ddst-wrapper.1in | 4 ++ foo2ddst-wrapper.in | 9 +++-- foo2ddst.1in | 4 ++ foo2ddst.c | 7 +++- foomatic-db/opt/foo2ddst-PrinterType.xml | 51 ++++++++++++++++++++++++ foomatic-db/printer/Ricoh-SP_112.xml | 9 +++++ 9 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 foomatic-db/opt/foo2ddst-PrinterType.xml diff --git a/Makefile b/Makefile index 42ae0d3..20fae0e 100644 --- a/Makefile +++ b/Makefile @@ -1279,7 +1279,7 @@ zjsdecode.o: jbig.h zjs.h # # foo2* Regression tests # -test: testzjs testhp +test: testzjs testhp testddst @ls -l *.z* #*.oak # # All regression tests passed. @@ -1360,6 +1360,20 @@ lj2600.zc1: testpage.ps foo2hp2600-wrapper foo2hp Makefile FRC @got=`md5sum $@`; grep -q "$$got" regress.txt || \ { echo "*** Test failure, got $$got"; ls -l $@; exit 1; } +# +# foo2ddst Regression tests +# +testddst: testpage.ps foo2ddst-wrapper foo2ddst foo2zjs-pstops FRC + @set -e; nohold=`mktemp`; hold=`mktemp`; \ + trap 'rm -f "$$nohold" "$$hold"' EXIT HUP INT TERM; \ + PATH=.:$$PATH foo2ddst-wrapper testpage.ps > "$$nohold"; \ + PATH=.:$$PATH foo2ddst-wrapper -H testpage.ps > "$$hold"; \ + if grep -a -q '@PJL SET HOLD=OFF' "$$nohold"; then \ + echo "*** Test failure, HOLD=OFF present without -H"; exit 1; \ + fi; \ + grep -a -q '@PJL SET HOLD=OFF' "$$hold" || \ + { echo "*** Test failure, HOLD=OFF missing with -H"; exit 1; } + # # foo2oak Regression tests # diff --git a/PPD/Ricoh-SP_112.ppd b/PPD/Ricoh-SP_112.ppd index ee42697..5d20a68 100644 --- a/PPD/Ricoh-SP_112.ppd +++ b/PPD/Ricoh-SP_112.ppd @@ -29,7 +29,7 @@ *LanguageEncoding: ISOLatin1 *PCFileName: "FOO2DDST.PPD" *Manufacturer: "Ricoh" -*Product: "(SP 112)" +*Product: "(SP 112 DDST)" *cupsVersion: 1.0 *cupsManualCopies: True *cupsModelNumber: 2 @@ -61,7 +61,7 @@ *Throughput: "1" *LandscapeOrientation: Plus90 *TTRasterizer: Type42 -*1284DeviceID: "MFG:Ricoh;MDL:SP 112;DRV:Dfoo2ddst,R1,M0,TF;" +*1284DeviceID: "MFG:RICOH ;MDL:SP 112 DDST;CMD:GDI;DRV:Dfoo2ddst,R1,M0,TF;" *driverName foo2ddst: "" *driverType F/Filter: "" @@ -89,6 +89,9 @@ *FoomaticIDs: Ricoh-SP_112 foo2ddst *FoomaticRIPCommandLine: "foo2ddst-wrapper %A" +*FoomaticRIPOption PrinterType: enum CmdLine A 110 +*FoomaticRIPOptionSetting PrinterType=Ricoh: "-H " + *OpenGroup: General/General *OpenUI *Resolution/Resolution: PickOne @@ -174,9 +177,11 @@ *OpenUI *InputSlot/Media Source: PickOne *FoomaticRIPOption InputSlot: enum CmdLine A *OrderDependency: 150 AnySetup *InputSlot -*DefaultInputSlot: Tray1 +*DefaultInputSlot: Auto *InputSlot Tray1/Tray 1: "%% FoomaticRIPOptionSetting: InputSlot=Tray1" *FoomaticRIPOptionSetting InputSlot=Tray1: "-s1 " +*InputSlot Auto/Auto selection: "%% FoomaticRIPOptionSetting: InputSlot=Auto" +*FoomaticRIPOptionSetting InputSlot=Auto: "-s3 " *InputSlot Manual/Manual Feed: "%% FoomaticRIPOptionSetting: InputSlot=Manual" *FoomaticRIPOptionSetting InputSlot=Manual: "-s2 " *CloseUI: *InputSlot diff --git a/PPD/Ricoh-SP_201Nw.ppd b/PPD/Ricoh-SP_201Nw.ppd index fd9f18b..d128b50 100644 --- a/PPD/Ricoh-SP_201Nw.ppd +++ b/PPD/Ricoh-SP_201Nw.ppd @@ -89,6 +89,9 @@ *FoomaticIDs: Ricoh-SP_201Nw foo2ddst *FoomaticRIPCommandLine: "foo2ddst-wrapper %A" +*FoomaticRIPOption PrinterType: enum CmdLine A 110 +*FoomaticRIPOptionSetting PrinterType=Ricoh: "-H " + *OpenGroup: General/General *OpenUI *Resolution/Resolution: PickOne @@ -174,9 +177,11 @@ *OpenUI *InputSlot/Media Source: PickOne *FoomaticRIPOption InputSlot: enum CmdLine A *OrderDependency: 150 AnySetup *InputSlot -*DefaultInputSlot: Tray1 +*DefaultInputSlot: Auto *InputSlot Tray1/Tray 1: "%% FoomaticRIPOptionSetting: InputSlot=Tray1" *FoomaticRIPOptionSetting InputSlot=Tray1: "-s1 " +*InputSlot Auto/Auto selection: "%% FoomaticRIPOptionSetting: InputSlot=Auto" +*FoomaticRIPOptionSetting InputSlot=Auto: "-s3 " *InputSlot Manual/Manual Feed: "%% FoomaticRIPOptionSetting: InputSlot=Manual" *FoomaticRIPOptionSetting InputSlot=Manual: "-s2 " *CloseUI: *InputSlot diff --git a/foo2ddst-wrapper.1in b/foo2ddst-wrapper.1in index 789d66e..2f834d3 100644 --- a/foo2ddst-wrapper.1in +++ b/foo2ddst-wrapper.1in @@ -100,6 +100,10 @@ Seascape -os (rotated 90 degrees clockwise) These are the options used to customize the operation of \fBfoo2ddst\fP for a particular printer. .TP +.BI \-H +Send a PJL command disabling job holding. This is required by some Ricoh +printers. +.TP .BI \-u\0 xoff x yoff Set the offset of the start of the printable region from the upper left corner, in pixels [varies with paper size]. diff --git a/foo2ddst-wrapper.in b/foo2ddst-wrapper.in index 6ac33c5..0caaede 100755 --- a/foo2ddst-wrapper.in +++ b/foo2ddst-wrapper.in @@ -71,6 +71,7 @@ Normal Options: -o orient For N-up: -op is portrait, -ol is landscape, -os is seascape. Printer Tweaking Options: +-H Send PJL HOLD=OFF. Required by some Ricoh printers. -u x Set offset of upper left printable in pixels [varies] -l x Set offset of lower right printable in pixels [varies] -L mask Send logical clipping values from -u/-l in ZjStream [3] @@ -179,6 +180,7 @@ GAMMAFILE= INTENT=0 GSOPTS= EXTRAPAD= +HOLD= SAVETONER= DENSITY=3 #Medium NUP_ORIENT= @@ -189,7 +191,7 @@ case `$GSBIN --version` in QUALITY=1 ;; esac -while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tT:ABS:D:G:I:PX:Vh?" opt +while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tT:ABHS:D:G:I:PX:Vh?" opt do case $opt in b) GSBIN="$OPTARG";; @@ -209,6 +211,7 @@ do L) CLIP_LOG="-L $OPTARG";; A) AIB=-A;; B) BC=-B;; + H) HOLD=-H;; C) COLORMODE="$OPTARG";; S) COLOR2MONO="-S$OPTARG";; D) DEBUG="$OPTARG";; @@ -662,7 +665,7 @@ $PREFILTER \ | foo2ddst -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \ $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \ -J "$LPJOB" -U "$USER" \ - $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG + $BC $AIB $HOLD $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG # # Log the command line, for debugging and problem reports @@ -673,7 +676,7 @@ if [ -x /usr/bin/logger ]; then logger -t "$BASENAME" -p lpr.info -- \ "foo2ddst -r$RES -g$DIM -p$PAPER -m$MEDIA \ -n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \ -$SAVETONER -T$DENSITY $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD" +$SAVETONER -T$DENSITY $BC $AIB $HOLD $COLOR2MONO $NOPLANES $EXTRAPAD" fi # diff --git a/foo2ddst.1in b/foo2ddst.1in index e5adfe5..067ee6f 100644 --- a/foo2ddst.1in +++ b/foo2ddst.1in @@ -116,6 +116,10 @@ AllIsBlack: convert C=1,M=1,Y=1 to just K=1. Works with bitcmyk input only. .TP .BI \-B BlackClears: K=1 forces C,M,Y to 0. Works with bitcmyk input only. +.TP +.BI \-H +Send a PJL command disabling job holding. This is required by some Ricoh +printers. .SS Debugging Options These options are used for debugging \fBfoo2ddst\fP. .TP diff --git a/foo2ddst.c b/foo2ddst.c index cb17a0e..23076d1 100644 --- a/foo2ddst.c +++ b/foo2ddst.c @@ -102,6 +102,7 @@ int PageNum = 0; int RealWidth; int EconoMode = 0; int PrintDensity = 3; +int PjlHoldOff = 0; int IsCUPS = 0; @@ -187,6 +188,7 @@ usage(void) "-A AllIsBlack: convert C=1,M=1,Y=1 to just K=1\n" "-B BlackClears: K=1 forces C,M,Y to 0\n" " -A, -B work with bitcmyk input only\n" +"-H Send PJL HOLD=OFF. Required by some Ricoh printers.\n" "-P Do not output START_PLANE codes. May be needed by some\n" " some black and white only printers.\n" "-X padlen Add extra zero padding to the end of BID segments [%d]\n" @@ -691,6 +693,8 @@ start_doc(FILE *fp) fprintf(fp, "@PJL SET COMPRESS=JBIG\r\n"); fprintf(fp, "@PJL SET USERNAME=%s\r\n", Username ? Username : "root"); fprintf(fp, "@PJL SET COVER=OFF\r\n"); + if (PjlHoldOff) + fprintf(fp, "@PJL SET HOLD=OFF\r\n"); #if 0 fwrite(header, 1, sizeof(header), fp); @@ -1422,7 +1426,7 @@ main(int argc, char *argv[]) int i, j; while ( (c = getopt(argc, argv, - "cd:g:n:m:p:r:s:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF) + "cd:g:n:m:p:r:s:tT:u:l:L:ABHPJ:S:U:X:D:V?h")) != EOF) switch (c) { case 'c': Mode = MODE_COLOR; break; @@ -1473,6 +1477,7 @@ main(int argc, char *argv[]) break; case 'A': AllIsBlack = !AllIsBlack; break; case 'B': BlackClears = !BlackClears; break; + case 'H': PjlHoldOff = 1; break; case 'P': OutputStartPlane = !OutputStartPlane; break; case 'J': if (optarg[0]) Filename = optarg; break; case 'U': if (optarg[0]) Username = optarg; break; diff --git a/foomatic-db/opt/foo2ddst-PrinterType.xml b/foomatic-db/opt/foo2ddst-PrinterType.xml new file mode 100644 index 0000000..38c18a2 --- /dev/null +++ b/foomatic-db/opt/foo2ddst-PrinterType.xml @@ -0,0 +1,51 @@ + diff --git a/foomatic-db/printer/Ricoh-SP_112.xml b/foomatic-db/printer/Ricoh-SP_112.xml index 453acd5..6fdb004 100644 --- a/foomatic-db/printer/Ricoh-SP_112.xml +++ b/foomatic-db/printer/Ricoh-SP_112.xml @@ -39,6 +39,15 @@ --> + + + MFG:RICOH ;CMD:GDI;MDL:SP 112 DDST;CLS:PRINTER; + RICOH + SP 112 DDST + GDI + Ricoh SP 112 DDST + + B foo2ddst