Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Port redirection and Samba printing

81 views
Skip to first unread message

James J. Weinkam

unread,
Nov 21, 2014, 1:47:59 AM11/21/14
to
I have a number of programs that produce pcl output. With a parallel printer connected to parallel port x, I can either
configure the program to write to lptx or configure it to write to a file and copy the file to lptx.

Similarly, the latest version of ghostscript refuses to write directly to the printer but will print to a ps file. So
far Paul Smedley hasn't figured out the cause. Again if a ps printer is connected to parallel port x, it suffices to
copy the ps file to lptx.

Parallel ports have gone the way of the dodo, and my current printers use USB. Until now, I have "solved' this problem
using peer networking by sharing the printer and then connecting to it as lptx. Once the connection is established, the
spooler redirection page shows the lptx port as being redirected to the printer (provided x<=3).

Recently, I have been experimenting with switching from peer networking to samba. To keep my options open, I have
converted my maintenance partitions to samba, leaving the regular partitions using peer. Unfortunately connecting to
shared printers is not yet supported in the eCS version of the samba client although there is supposed to be a
workaround using virtual SMB ports.

Method 1:

I tried to set up port redirection using the output tab in the properties notebook of the printer object. This looks
like it worked, and indeed the redirection tab in the spooler note book indicates that the port has been redirected to
the chosen printer.

However copy /b output.pcl lptx says 1 file copied but the file disappears into cyberspace. Nothing shows up on the
printer or in the spooler file corresponding to the printer.

As a workaround, I can drag and drop the pcl file onto the printer object but this is labor intensive and can't be put
into a command script.

Questions:

Am I doing something wrong in setting up redirection? If so how is it done correctly?

Is there a command line program I can invoke directly that does whatever happens when a printer specific file is dropped
onto a printer object?

Method 2:

Creating and configuring a SMB port as described in the Introduction to Local Network Services Help File in the Local
Network desktop folder also seems to work. Indeed, clicking on the target printer in the Samba Clients Network
Neighborhood window shows, "HP2100PC prints to port SMB1 connected to \\IBMPEERS\JJW0\HP2100PC". Dropping a pcl file on
the HP2100PC printer object while watching the HP2100PC window in details view results in a line describing the job and
stating that it is being sent to the printer which remains for a period of time consistent with the size of the job and
then disappears. Unfortunately the job also disappears. No trace of it can be seen at the other end.

Question:

Is there something I need to set up at the receiving end that I have overlooked. Does anyone know how to get this working?


Thanks in advance for any assistance anyone can offer.


Alex Taylor

unread,
Nov 25, 2014, 8:31:22 AM11/25/14
to
On Fri, 21 Nov 2014 06:47:55 UTC, "James J. Weinkam" <j...@cs.sfu.ca> wrote:

> Parallel ports have gone the way of the dodo, and my current printers use USB.
> Until now, I have "solved' this problem using peer networking by sharing the
> printer and then connecting to it as lptx. Once the connection is established,
> the spooler redirection page shows the lptx port as being redirected to the
> printer (provided x<=3).
>
> I tried to set up port redirection using the output tab in the properties
> notebook of the printer object. This looks like it worked, and indeed the
> redirection tab in the spooler note book indicates that the port has been
> redirected to the chosen printer.
>
> However copy /b output.pcl lptx says 1 file copied but the file disappears
> into cyberspace. Nothing shows up on the printer or in the spooler file
> corresponding to the printer.
>
> As a workaround, I can drag and drop the pcl file onto the printer object
> but this is labor intensive and can't be put > into a command script.

Does this help? http://www.altsan.org/os2/printing/index.html#eprint


--
Alex Taylor
http://www.altsan.org

Please take off hat when replying.

James J. Weinkam

unread,
Dec 4, 2014, 11:49:13 PM12/4/14
to
Thanks very much for this and sorry for not responding sooner. Your post appeared while we were out of town.

Over the last few days I have tested eprint in a variety of circumstances. Here is a summary of the results:

Regardless of whether Peer networking or Samba is being used, eprint works ok when writing directly to a hardware port
such as LPT1 or USB e.g., HP_CLJ_CP2025dn_1. Needless to say, the copy command only works for LPT ports.

eprint file /D:\PIPE\LPD0 fails with PrtWrite returned error 233.

Under Peer networking:

There are two ways to set up a "connection" between a LPT port and a printer object: one is by sharing the printer
object and then connecting to it using either a net use command or the Sharing and Connecting tool; the other is either
by right clicking on the desired LPT port on the Output Port tab of the Printer object's properties notebook and
clicking on redirection or by using the spool command to specify the desired redirection.

The spooler redirection method only supports LPT1-LPT3; the sharing and connecting method also supports LPT4 and higher.

Using the sharing and connecting method, eprint works for LPT1-LPT3 and reports port not found for higher numbered LPT
ports. The copy command works for all.

Using spooler redirection, eprint silently fails. Copy works correctly. In particular, Spooler redirection works for the
network printer on \PIPE\LPD0, so that copy can copy a file to it that prints correctly.

Under Samba:

The good news is that eprint works for a local printer attached to a LPT or USB port. That covers about 80% of my cases.

Setting up spooler redirection behaves exactly as it does running under Peer. However nothing sent to the redirected
port shows up anywhere. eprint fails silently. copy responds 1 file copied, but the file just disappears.

The remaining problem is to get printing to a shared printer on another machine working.

The Samba server seems to offer printers for sharing ok. On the client side, creating a printer object with the
appropriate driver and specifying a SMB port directed at the appropriate shared printer also seems to work. If I open
that printer object and also the spooler's SMB directory and send a job to that printer using any method, I can see the
job appear on the printer object and then in the SMB directory on the client machine. After a time they disappear but
nothing happens on the server side.

The Warpin installer seems to have set everything up correctly except for the 'printing = bsd' line in the [global]
section of smb.conf.

The upshot is that until I get this solved I will have to transfer the pcl or ps file to the other machine over the
network and that copy it to the printer locally using eprint.

This is certainly a big step in the right direction. Thanks again.

I would appreciate any help anyone can offer on the server side smbprint configuration.

ivan

unread,
Dec 5, 2014, 5:06:57 PM12/5/14
to
On Fri, 5 Dec 2014 04:49:10 UTC, "James J. Weinkam" <j...@cs.sfu.ca>
Just to confirm what you are saying James. We can print to almost any
printer on the local machine but the moment the print job goes out on
to the network it vanishes into a black hole.

We have the office printer connected to a print server and every OS
except OS/2 can print to it via Samba. I can copy a raw print file
from OS/2 to it and it will print ONCE, then it has to be switched off
and on again to print the next file.

At the moment, if we need to do any printing it is sent to a linux VM
and from there to the printer. It does get the printing done but is a
multi step process.

If this printing problem can be fixed I know of a lot of people that
will be very happy.

ivan
--

James J. Weinkam

unread,
Dec 7, 2014, 4:07:10 PM12/7/14
to
I originally posted this request for help after temporarily giving up on an attempt to write a PL/I program to copy
printer specific files to a spooler queue. Yesterday, my son came over and we revisited my program. It is embarrassing
to have to admit that I got confused and declared several variables that correspond to ULONGs as bin fixed(15) instead
of bin fixed(31). I was led astray by the description of the jobid returned by SplQmEndDoc as ULONG between 1 and 65535.
Once this error was fixed the program worked. I have tested the program under Peer and Samba and it does its job
correctly in all cases. The output still fails to appear on shared printers under Samba, but that is a different
problem. I shall post more information on that later. Writing to the spooler obviates the need for port redirection. Of
course, the program is useless if there is a need to write directly to a port.

Question to Alex Taylor: Do you have a reason for wanting to bypass the spooler? My own inclination is to use the
spooler to ensure correct behavior if others in the household are sending jobs to the same printer simultaneously.

PL/I source available upon request.

James J. Weinkam

unread,
Dec 8, 2014, 1:59:50 AM12/8/14
to
ivan wrote:
>
> Just to confirm what you are saying James. We can print to almost any
> printer on the local machine but the moment the print job goes out on
> to the network it vanishes into a black hole.
>
> We have the office printer connected to a print server and every OS
> except OS/2 can print to it via Samba. I can copy a raw print file
> from OS/2 to it and it will print ONCE, then it has to be switched off
> and on again to print the next file.
>
> At the moment, if we need to do any printing it is sent to a linux VM
> and from there to the printer. It does get the printing done but is a
> multi step process.
>
> If this printing problem can be fixed I know of a lot of people that
> will be very happy.
>
I shall be among them!

I did some experiments today and found that we are actually very close to getting printing working.

I took my T60 down to the office desktop machine so I could see both screens at the same time.

On the desktop machine I have an HP2100M directly connected to LPT1. There are two printer objects: HP2100PC using the
LASERJET.HP Laserjet 2100 driver, and HP2100PS using the PSCRIPT.HP Laserjet 2100 Series PS driver.

On the T60 I also have two printer objects HP2100PC and HP2100PS using the same drivers as their counterparts on the
desktop and connected to SMB1 and SMB2 respectively.

I shall describe an attempt to send a pcl file from the T60 to HP2100PC on the desktop using Samba. Sending a ps file to
HP2100PS is essentially identical.

On both machines I placed the HP2100PC printer object in hold status and opened it.

On the T60 I ran fil2prt /HP2100PC <output.pcl. output.pcl is a 150575 byte file.

I then looked in f:\MPTN\ETC\samba\spool\HP2100PC and compared the .SPL file to output.pcl. They were identical. This
shows that fil2prt performed correctly.

On the T60 I opened the directory f:\MPTN\ETC\samba\spool\SMB in details view and changed the status of HP2100PC to Release.

I could see the SPL file go by in the SMB directory and the size shown was 150575 bytes. This strongly suggests but does
not prove that the file was transmitted to the server correctly by the client.

Next I looked at the SHD and SPL files in f:\MPTN\ETC\samba\spool\HP2100PC on the desktop.

The SHD files were not identical but were very similar. Yhey are binary files and I no nothing whatever about their
format. However various words relating to printer options appear in them and the same options appear in both of them in
the same order but not at the same offsets. It appears that these files are ok, although the possibility remains that
some corruption may have crept in.

The big difference is in the SPL file. The SPL file at the server end is small enough to present in its entirety:

00000000 1B 25 2D 31 32 33 34 35 58 40 50 4A 4C 20 4A 4F %-12345X@PJL JO
00000010 42 20 4E 41 4D 45 3D 22 52 65 6D 6F 74 65 20 44 B NAME="Remote D
00000020 6F 77 6E 6C 65 76 65 6C 20 44 6F 63 75 6D 65 6E ownlevel Documen
00000030 74 20 66 72 6F 6D 20 4A 4A 57 33 22 0A 40 50 4A t from JJW3" @PJ
00000040 4C 20 53 45 54 20 43 4F 50 49 45 53 3D 31 20 0A L SET COPIES=1

00000050 40 50 4A 4C 20 53 45 54 20 52 45 53 4F 4C 55 54 @PJL SET RESOLUT
00000060 49 4F 4E 3D 36 30 30 20 0A 40 50 4A 4C 20 53 45 ION=600 @PJL SE
00000070 54 20 52 45 54 3D 4D 45 44 49 55 4D 20 0A 40 50 T RET=MEDIUM @P
00000080 4A 4C 20 53 45 54 20 45 43 4F 4E 4F 4D 4F 44 45 JL SET ECONOMODE
00000090 3D 4F 46 46 20 0A 40 50 4A 4C 20 53 45 54 20 44 =OFF @PJL SET D
000000A0 55 50 4C 45 58 3D 4F 46 46 20 0A 40 50 4A 4C 20 UPLEX=OFF @PJL
000000B0 45 4E 54 45 52 20 4C 41 4E 47 55 41 47 45 3D 50 ENTER LANGUAGE=P
000000C0 43 4C 58 4C 20 0A 29 20 48 50 2D 50 43 4C 20 58 CLXL ) HP-PCL X
000000D0 4C 3B 31 3B 31 3B 43 6F 6D 6D 65 6E 74 0A D1 58 L;1;1;Comment ÐX
000000E0 02 58 02 F8 89 C0 00 F8 86 C0 03 F8 8F 41 C0 00 X °ë└·°å└ °ÅA└·
000000F0 F8 88 C0 01 F8 82 48 49 42 1B 25 2D 31 32 33 34 °ê└ °éHIB %-1234
00000100 35 58 5X

(Line feed characters (0A) have been changed to spaces in the right panel.)

So it looks to me as if the receiving program on the server end is attempting to process the file even though the
PM_Q_RAW specification is clearly present in the SHD file.

For completeness, here are the first 512 bytes of output.pcl:

00000000 1B 25 2D 31 32 33 34 35 58 40 50 4A 4C 20 45 4E %-12345X@PJL EN
00000010 54 45 52 20 4C 41 4E 47 55 41 47 45 3D 50 43 4C TER LANGUAGE=PCL
00000020 0A 1B 45 1B 28 31 30 55 1B 26 6C 32 61 31 6F 30 E (10U &l2a1o0
00000030 6C 36 64 31 65 34 38 46 1B 26 6B 31 32 48 1B 26 l6d1e48F &k12H &
00000040 61 30 6C 31 30 36 4D 1B 2A 70 33 31 37 39 78 30 a0l106M *p3179x0
00000050 59 1B 2A 74 33 30 30 52 1B 2A 72 33 66 31 41 1B Y *t300R *r3f1A
00000060 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 *b1m4W··+· *b1m4
00000070 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 W··+· *b1m4W··+·
00000080 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D *b1m4W··+· *b1m
00000090 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 4W··+· *b1m4W··+
000000A0 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 · *b1m4W··+· *b1
000000B0 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 m4W··+· *b1m4W··
000000C0 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 +· *b1m4W··+· *b
000000D0 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 1m4W··+· *b1m4W·
000000E0 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A ·+· *b1m4W··+· *
000000F0 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 b1m4W··+· *b1m4W
00000100 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B ··+· *b1m4W··+·
00000110 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 *b1m4W··+· *b1m4
00000120 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 W··+· *b1m4W··+·
00000130 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D *b1m4W··+· *b1m
00000140 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 4W··+· *b1m4W··+
00000150 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 · *b1m4W··+· *b1
00000160 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 m4W··+· *b1m4W··
00000170 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 +· *b1m4W··+· *b
00000180 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 1m4W··+· *b1m4W·
00000190 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A ·+· *b1m4W··+· *
000001A0 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 b1m4W··+· *b1m4W
000001B0 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B ··+· *b1m4W··+·
000001C0 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 *b1m4W··+· *b1m4
000001D0 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 00 W··+· *b1m4W··+·
000001E0 1B 2A 62 31 6D 34 57 FF 00 2B 00 1B 2A 62 31 6D *b1m4W··+· *b1m
000001F0 34 57 FF 00 2B 00 1B 2A 62 31 6D 34 57 FF 00 2B 4W··+· *b1m4W··+

Does anyone know enough about what happens under the covers to figure out what the problem is and how to fix it?





James J. Weinkam

unread,
Dec 8, 2014, 4:20:26 AM12/8/14
to
James J. Weinkam wrote:

Sorry to reply to my own post.

One additional piece of information that I forgot to include is that during the transmission of the SPL file from the
T60 to the desktop, a window opens up on the desktop screen fro a few seconds. There is not enough time to read its
contents, so I set up a camera on a tripod and took a picture when the window appeared. It took a few tries to get a
readable result.

The title bar says: VX-REXX Console for Samba Print Command for OS/2.

There are both horizontal and vertical scroll bars so not everything is visible. The window content reads:
Printparms='"smbprn,00000022.09uNvW" "HP2100PC" "Remote D:
86
Verzeichnis: "F:\MPTN\ETC\samba\spool\HP2100PC"
Spoolfile: "smbprn.00000022.09uNvW"
Smbprinter: "HP2100PC"
HP2100PC:HP2100PC:LASERJET.HP LaserJet 2100
HP2100PC<-->HP2100PC

Behind that window, the right half of another window is visible:

Title Bar: ...mand for OS/2

Content: ...rom JJW3" (0, 150575 bytes) to

This suggests that the entire 150575 bytes were transmitted from the T60 to the desctop or at least that the desktop
software at least knew it was supposed to receive 150575 bytes.

This suggests to me that the guilty program is smbprint.exe.

James J. Weinkam

unread,
Dec 10, 2014, 12:13:39 AM12/10/14
to
I have succeeded in getting Samba printing working in eCS. Here are the details:

I had concluded that smbprint was the most likely culprit for the failure of printing to work, so I tried to lay my
hands on the source. I found smbprint.cmd and smbprint.vrx at netlabs. smbprint.vrx was useless. Here is smbprint.cmd


/* REXX */
parms = arg(1)

parse var parms '"'spoolfile'" "'printername'" "'Jobname'" "'pages'" "'Jobsize'"'
call beep 880, 100
/* 'D:\TCPIP\BIN\LPR.EXE -s eps.bfdnet.at -p 'printername' 'spoolfile */
'copy /B 'spoolfile' 'printername
call lineout 'D:\Samba\print.log','spoolfile ='spoolfile
call lineout 'D:\Samba\print.log','printername ='printername
call lineout 'D:\Samba\print.log','Jobname ='Jobname
call lineout 'D:\Samba\print.log','pages ='pages
call lineout 'D:\Samba\print.log','Jobsize ='Jobsize
/* ok = SysFileDelete(SpoolFile) */

This is too short to be the actual source for the smbprint.exe that comes with Samba; nevertheless it provides some clues:

The only really useful information here is the identification and ordering of the parameters, the name of the print log,
and the hint that the only substantive operation to be done is to copy spoolfile to the printer queue..

Here is what I came up with:

/* jjw20141209 - smbprint.cmd replacement for smbprint.exe */
parse arg '"'spoolfile'" "'printername'" "'jobname'" "'pages'" "'jobsize'"'
d=date('S')
call lineout 'G:\Samba\print.log',substr(d,1,4)'/'substr(d,5,2)'/'substr(d,7)'-'time()' 'jobname
rc=stream('G:\Samba\print.log','c','close')
'set beginlibpath=g:\ibmpli\dll;'
'set path=g:\ibmpli\bin;%path%'
'set dpath=g:\ibmpli\msg;%dpath%'
'e:\pli\apps\fil2prt.exe /'printername' <'spoolfile' >>G:\samba\print.log'
call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
rc=SysFileDelete(spoolfile)

This can be further simplified if you are willing to dispense with the print log. I decided to use it for a while until
I am satisfied that the system is stable. At that point out it goes.

It is also necessary to have Samba and the spooler properly configured.

I have samba itself installed in g:\samba. However for each bootable instance samba also keeps certain information on
the boot drive. At the moment, I have only one bootable partition using samba which is my maintenance partition on drive
f. Instance specific information is stored in the tree under %boot%:\MPTN\ETC\samba. In particular, smb.conf is in the
samba directory and Samba sets up its own internal "spooler" in the spool directory under samba with a subdirectory for
each printer object. Do not point the real eCS spooler at this spool directory.

Basically, a printer specific spool file received from another computer is first placed in
%boot%:\MPTN\ETC\samba\spool\printer with a weird name. Then smbprint is called into action and it writes that file to
the real spooler which goes on to send it to the printer. Then smbprint must delete the file received from the other
computer from Samba's internal spooler.

Here are the relevant sections from my smb.conf file (I have flagged the important lines with an * in the left margin):

# Samba config file created using SSCC ver. 1.0.3
# from jjw@JJW3
# Date: 20 Nov 2014 20:25:07
[global]
workgroup = IBMPEERS
null passwords = Yes
passdb backend = tdbsam
guest account = guest
username map = F:\MPTN\ETC\samba\private\smbusermap
log level = 2
log file = F:\MPTN\ETC\samba\log\log.smbd.%U.%M
time server = Yes
load printers = No
* printing = os2
printcap name = G:\etc\printcap
* print command = G:\samba\smbprint.cmd "%s" "%p" "%J" "%c" "%z"
+ lpq command = lpq.exe -s %i -p %p
+ lprm command = lprm.exe -s %i -p %p %j
enumports command = G:\samba\enumports.cmd
add user script = G:\samba\usermod.cmd -a "%u"
rename user script = G:\samba\usermod.cmd -r "%uold" "%unew"
delete user script = G:\samba\usermod.cmd -x "%u"
add group script = G:\samba\groupmod.cmd -a "%g"
delete group script = G:\samba\groupmod.cmd -x "%g"
add user to group script = G:\samba\groupmod.cmd -j "%g" "%u"
delete user from group script = G:\samba\groupmod.cmd -l "%g" "%u"
set primary group script = G:\samba\usermod.cmd -p "%u" "%g"
add machine script = G:\samba\usermod.cmd -a "%u"
lm announce = Yes
wins support = Yes
add share command = G:\samba\addshare.cmd
change share command = G:\samba\changeshare.cmd
delete share command = G:\samba\delshare.cmd
lock directory = F:\MPTN\ETC\samba\lock
create mask = 0777
ea support = Yes
store dos attributes = Yes

[HOMES]

... drive shares

[CP2025PC]
path = F:/MPTN/ETC/samba/spool/CP2025PC
read only = No
create mask = 0700
guest ok = Yes
printable = Yes
printer name = CP2025PC

[CP2025PS]
path = F:/MPTN/ETC/samba/spool/CP2025PS
read only = No
create mask = 0700
guest ok = Yes
printable = Yes
printer name = CP2025PS

Note that the printing, print, lpq, and lprm lines have been deleted from the printer specific sections and a single
copy of each has been placed in the global section. I have no idea whether or not the lpq and lprm lines are actually
needed for anything; the look superfluous to me. Also note that printing=os2 as set up by the warpin installer seems to
work just as well as the printing=bsd setting specified in Herwig Bauernfeind's instructions. If someone knows
otherwise, please speak up.

Finally here is the source for fil2prt. It should be straightforward to transliterate to other languages.

% process mar(2,100),offset,libs(multi); /* fil2prt */
/* jjw20141205 - fil2prt {/}queue <prtfile - copy a printer specific file to a printer queue */
/* (c) 2014 James J. Weinkam */
fil2prt: proc(cmd) options(main noexecops) reorder;
dcl
cmd char(*) var,
(queue,strz based) char(256) varz,
(bp,ib,p3,hs,(rp,si) init(null)) ptr,
(rc,nr,bs,nq,na,sa,i,tw) bin fixed(31),
(dtatyp init('PM_Q_RAW'),cmt init('fil2prt')) char(8) varz,
1 info3 based(p3),
2 pnm ptr,
2 (prty,strt,untl) bin fixed(15),
2 (*,*,*,*,*,dflt,byps,raw,*,*,*,*,*,*,*,*) bit(1),
2 (sep,qprc,qpar,qdsc) ptr,
2 (stat,jobs) bin fixed(15),
2 (ptrs,drvr,drvd) ptr,
1 devopnstr,
2 (loga,dvrnm,drvdta,dtyp,com,qproc,qpparm,qsplp,qnetp) ptr,
((SplEnumQueue entry(char(*) varz byaddr,bin fixed(31),ptr,bin fixed(31),
bin fixed(31) byaddr,bin fixed(31) byaddr,bin fixed(31) byaddr,ptr),
DosRead entry(ptr,ptr,bin fixed(31),bin fixed(31) byaddr),
SplQmStartDoc entry(ptr,char(*) varz byaddr),
SplQmWrite entry(ptr,bin fixed(31),ptr),
(SplQmClose,SplQmEndDoc) entry(ptr)) returns(bin fixed(31) byvalue),
SplQmOpen entry(char(*) varz byaddr,bin fixed(31),* byaddr) returns(ptr byvalue))
external options(byvalue nodescriptor linkage(system)),
sysprint file print,
(addr,allocate,index,length,null,plifree,substr,trim) builtin;

queue=substr(cmd,1+index(cmd,'/'));
if length(queue)=0 then do;
put file(sysprint) edit('Usage: fil2prt {/}queue <prtfile')(col(1),a); goto fini;
end;
rc=splenumqueue('',3,bp,0,nq,na,sa,rp);
if rc~=234&rc~=2123 then do;
put file(sysprint) edit('Invalid error code from SplEnumQueue.')(col(1),a); goto fini;
end;
bs=sa; bp=allocate(bs);
rc=splenumqueue('',3,bp,bs,nq,na,sa,rp); p3=bp;
if rc~=0 then do;
put file(sysprint) edit('Error getting printer object information.')(col(1),a); goto freebp;
end;
work: do i=1 to nq;
if pnm->strz=queue then do;
loga=pnm; dvrnm=drvr; drvdta=drvd; dtyp=addr(dtatyp); com=addr(cmt);
qproc,qpparm,qsplp,qnetp=null;
hs=splqmopen('*',4,devopnstr);
if hs=null then do;
put file(sysprint) edit('Unable to open spool file')(col(1),a); goto freebp;
end;
rc=splqmstartdoc(hs,'prtfile');
ib=allocate(61440); tw=0;
do forever;
rc=dosread(si,ib,61440,nr);
if nr>0 then do; tw+=nr; rc=splqmwrite(hs,nr,ib); end;
if nr<61440 then leave;
end;
put file(sysprint)
edit(vfmt(tw),' bytes written to ',queue,'; job id ',vfmt(splqmenddoc(hs)),'.')
(col(1),6 a);
rc=splqmclose(hs); call plifree(ib); goto freebp;
end;
p3+=44;
end work;
put file(sysprint) edit(queue,' not found.')(col(1),2 a);
freebp: call plifree(bp);
vfmt: proc(i) returns(char(12) var);
dcl i bin fixed(31),c char(12);
put string(c) edit(i)(f(12)); return(trim(c,' '));
end;
fini: end fil2prt;

ivan

unread,
Dec 10, 2014, 7:22:08 AM12/10/14
to
On Wed, 10 Dec 2014 05:13:36 UTC, "James J. Weinkam" <j...@cs.sfu.ca>
wrote:
Thanks James.

I will give this a try as soon as we can get a test setup up and
running - rather flat out at the moment with clients gearing up for
the ski season.

ivan
--

James J. Weinkam

unread,
Dec 11, 2014, 3:46:41 AM12/11/14
to
ivan wrote:
> On Wed, 10 Dec 2014 05:13:36 UTC, "James J. Weinkam"<j...@cs.sfu.ca>
> wrote:
>
>> I have succeeded in getting Samba printing working in eCS. Here are the details:

...

>
> Thanks James.
>
> I will give this a try as soon as we can get a test setup up and
> running - rather flat out at the moment with clients gearing up for
> the ski season.
>

Good luck in getting printing working on your system.

One thing I forgot to mention is that I found it necessary to check the printer specific format box on the Queue Options
tab of the Printer properties notebook for the printer objects on both the sending and receiving ends. Print while
spooling is also a good idea.

ivan

unread,
Dec 11, 2014, 10:58:17 AM12/11/14
to
On Thu, 11 Dec 2014 08:46:35 UTC, "James J. Weinkam" <j...@cs.sfu.ca>
I can see this is going to be fun ;)

Our print server is accessed using an IP adderss <IP address/lp>.
There are no printer drivers on it, those and the spool reside on the
sending box.

The anoying thing is that any of our clients that have a windows
notebook or Android tablet can print to it without problems as can we
from a Linux box and any of our tablets - just not from OS/2.

There has to be a way - it is just a matter of finding it.

ivan
--

James J. Weinkam

unread,
Dec 11, 2014, 6:23:29 PM12/11/14
to
fil2prt /NETPTR <pcl-or-psfile

works here, where NETPTR is the name of the printer object for the printer connected directly to the network. This goes
straight to the printer and does not involve all the rigamarole needed for printing to a shared printer.

Drag and drop of a printer specific file or printing to that printer object from applications that can do so also works.

I have the \PIPE\LPD0 port configured as follows:

LPD server = ip address of printer
LPD printer = lp (Different make and model printers require different settings here; lp works for most HP printers)
Host name = name of your computer, i.e., whatever you have in SET HOSTNAME in config.sys.
Data Transfer Mode: Non Streaming Mode

You also have to configure your system to start LPRPORTD at boot time or start it yourself manually (detach lprportd).

Go to SystemSetup->Network->TCP/IP->TCP/IP Configuration->Autostart

Under Autostarted Services click on lprportd. Under Autostart Options make sure that Autostart Service and Detached are
selected, save the configuration, and reboot.

I just noticed that you mention a printer server. What I have is a HP CP2025dn which has a network connector as well as
a USB connector. The HP documentation states that the network connection includes a built in server. If what you have is
a printer server device attached to the network to which one or more printers are attached then I think what you need is
to create a SLPR port for your printer and configure it appropriately. I know nothing about this; I assume you would put
in the ip address for the server and a printer name or other id code to specify which of several attached printers you
want to use. Presumably the server's user manual would explain that.

Also, I see no mention in your posts of what version of OS/2 or eCS you are using. I would say that the older the
version of OS/2 you are using the less chance you have of getting it to work. I am using eCS2.2betaII and still needed
to replace smbprint to get sharing and connecting working. I also had to write a program that can copy a printer
specific file to a printer object unless I wanted to use drag and drop. YMMV.




Peter Brown

unread,
Dec 11, 2014, 7:27:16 PM12/11/14
to
Hi ivan

ivan wrote:
>

----- snip -----


>
> I can see this is going to be fun ;)
>
> Our print server is accessed using an IP adderss<IP address/lp>.
> There are no printer drivers on it, those and the spool reside on the
> sending box.
>
> The anoying thing is that any of our clients that have a windows
> notebook or Android tablet can print to it without problems as can we
> from a Linux box and any of our tablets - just not from OS/2.
>
> There has to be a way - it is just a matter of finding it.
>
> ivan



I've been using cups to print via a print server for a few years; prior
to that I was using the slpr port as the output port for my local
printer to print via a print server.

Either method should work - cups may just take a bit more time to set up
though :-)


Regards

Pete

Alex Taylor

unread,
Dec 12, 2014, 7:19:47 AM12/12/14
to
On Sun, 7 Dec 2014 21:07:08 UTC, "James J. Weinkam" <j...@cs.sfu.ca> wrote:

> Question to Alex Taylor: Do you have a reason for wanting to bypass the spooler? My
> own inclination is to use the spooler to ensure correct behavior if others in the
> household are sending jobs to the same printer simultaneously.

In fact, I originally wrote EPRINT in order to act as a backend to a printer
object using UNIPDR, as I described on this page:
http://trac.netlabs.org/ecups/wiki/GhostScriptRasterPrinting
In that scenario, the job has already gone through the spooler before it
reached
EPRINT, so spooling it again would be redundant; I simply wanted to send it
directly to the USB hardware.

Some time after the first release, I tried to add an option to send the
job through the spooler. Unfortunately, I couldn't get it to work. After
some brief attempts to debug it, I kind of lost interest, seeing as the
program already basically did what I personally needed it to.. :)

If I ever get around to it, I may revisit it at some point.

Alex Taylor

unread,
Dec 12, 2014, 8:24:32 AM12/12/14
to
On Fri, 5 Dec 2014 04:49:10 UTC, "James J. Weinkam" <j...@cs.sfu.ca> wrote:

> Over the last few days I have tested eprint in a variety of circumstances.
> Here is a summary of the results:
>
> Regardless of whether Peer networking or Samba is being used, eprint works ok when
> writing directly to a hardware port such as LPT1 or USB e.g., HP_CLJ_CP2025dn_1.
>
> eprint file /D:\PIPE\LPD0 fails with PrtWrite returned error 233.

That is a "Pipe Not Connected" error. It means the other end of the pipe
closed the connection (or possibly failed to enable it). I don't really
know what would cause that, but the LPR pipe driver is a bit weird and
confusing anyway. IMHO it's better to use the SLPR port driver.


> Using the sharing and connecting method, eprint works for LPT1-LPT3 and
> reports port not found for higher numbered LPT ports.

Interesting. Does EPRINT /L report LPT4 to exist or not?


> Using spooler redirection, eprint silently fails.

That because, as you've discovered, EPRINT doesn't go through the spooler at
all.

James J. Weinkam

unread,
Dec 13, 2014, 5:46:12 PM12/13/14
to
Alex Taylor wrote:
> On Fri, 5 Dec 2014 04:49:10 UTC, "James J. Weinkam"<j...@cs.sfu.ca> wrote:
>
>> Over the last few days I have tested eprint in a variety of circumstances.
>> Here is a summary of the results:
>>
>> Regardless of whether Peer networking or Samba is being used, eprint works ok when
>> writing directly to a hardware port such as LPT1 or USB e.g., HP_CLJ_CP2025dn_1.
>>
>> eprint file /D:\PIPE\LPD0 fails with PrtWrite returned error 233.
>
> That is a "Pipe Not Connected" error. It means the other end of the pipe
> closed the connection (or possibly failed to enable it). I don't really
> know what would cause that, but the LPR pipe driver is a bit weird and
> confusing anyway. IMHO it's better to use the SLPR port driver.
>
I have taken your advice. It certainly seems to work at least as well and is easier to configure. Thanks for the
information.
>
>> Using the sharing and connecting method, eprint works for LPT1-LPT3 and
>> reports port not found for higher numbered LPT ports.
>
> Interesting. Does EPRINT /L report LPT4 to exist or not?
>

Thanks for your response.

eprint /l reports:

------------------------------------------------------------------------------
Port Name Port Driver
------------------------------------------------------------------------------
LPT1 D:\OS2\DLL\PARALLEL.PDR
LPT2 D:\OS2\DLL\PARALLEL.PDR
HP_CLJ_CP2025dn_1 D:\OS2\DLL\USBPRT.PDR
\PIPE\LPD0 D:\TCPIP\DLL\LPRPDRVR.PDR
FILE
COM2 D:\OS2\DLL\SERIAL.PDR
COM1 D:\OS2\DLL\SERIAL.PDR
LPT3 D:\OS2\DLL\PARALLEL.PDR
------------------------------------------------------------------------------

Curiously FILE is included in the list as a port, presumably because I have one printer object configured to print to a
file which I then convert to pdf using Ghostscript. Also com1 and com2 are listed even though the computer doesn't have
a serial port and all the related drivers are remmed out in config.sys.


I am beginning to wonder if all of the behavior I reported when Samba is running is correct. It seems like Samba behaves
differently every time I boot the maintenance partitions to test something. Since I am new to Samba, I probably have
somethng configured incorrectly somewhere although it seems pretty straightforward. Right now I can't test anything
having to do with Samba. We had a major wind storm Thursday night which caused a three-hour power outage while the
systems were running on the maintenance partitions, albeit quiescent. Upon rebooting and restarting Samba everything was
scrambled. I don't dare try any file operations until I sort this out. It looks like I may have to uninstall and
reinstall the server on each system. Samba seems a lot more fragile than peer. Once I get it working again I'll do some
more tests and let you know what happens.

ivan

unread,
Dec 13, 2014, 5:57:24 PM12/13/14
to
On Thu, 11 Dec 2014 23:23:28 UTC, "James J. Weinkam" <j...@cs.sfu.ca>
Sorry, we are using WSeB with FP6 and any other updates we can find.
Our printers are a collection of HP laserjets with the main one being
an HP CLJ 3500. They have either an HP ethernet to USB print server
or are connected to one of the NAS print server USB ports.

Where can I get a copy of your fil2prt because if I can use that to
print it will cut out the need to have a very cut down XP running in a
VM to do the printing.

ivan
--

James J. Weinkam

unread,
Dec 15, 2014, 5:24:58 PM12/15/14
to
ivan wrote:
>
> Where can I get a copy of your fil2prt because if I can use that to
> print it will cut out the need to have a very cut down XP running in a
> VM to do the printing.
>

Email me privately.

Paul Ratcliffe

unread,
Dec 16, 2014, 3:01:00 PM12/16/14
to
Is it possible to email publicly?

James J. Weinkam

unread,
Dec 16, 2014, 4:00:35 PM12/16/14
to
Good question; I suppose you could cc the newsgroup.
0 new messages