Re: LPR/LPD does not run filters

2015-10-28 Thread Christian Weisgerber
On 2015-10-27, Jona Joachim  wrote:

> Well, specifying 'lp' instead of 'rm' does make it run filters, but the job
> is not sent to the printer, even when I use the port@host format from
> the man page. As soon as I set 'rm', filters are no longer executed.

Yes, that's the way lpd(8) has always worked.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: LPR/LPD does not run filters

2015-10-27 Thread Antoine Jacoutot
> Well, specifying 'lp' instead of 'rm' does make it run filters, but the job
p is not sent to the printer, even when I use the port@host format from
> the man page. As soon as I set 'rm', filters are no longer executed.

It's all documented in /usr/local/share/doc/pkg-readmes/cups-filters-*

Extract:

lpd(8): network printer printcap(5) example
---
rp|samsung|Samsung-ML-2850D:\
:lp=9100@1.2.3.4:\
:if=/path/to/script.sh:\
:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:\
:sh:
(where 1.2.3.4 is the printer IP address and 9100 the printer stream port)

foomatic-rip(1) does *not* speak LPD (port 515).
If the printer does not support raw printing over port 9100, it must be
setup locally on a print server (see above for an example using USB)
then accessed over LPD by the clients (there is no need to setup any
print filter on the clients since it will run on the print server).

-- 
Antoine



Re: LPR/LPD does not run filters

2015-10-27 Thread Jona Joachim
On 2015-10-27, Stuart Henderson  wrote:
> On 2015-10-25, Jona Joachim  wrote:
>> Hi, 
>> I was tired of CUPS so I decided keep it simple and stupid and use
>> lpd/lpr. Strangely, things don't work out as expected. It seems that
>> lpd never executes input filters.
>>
>> Here is the content of /etc/printcap:
>> lp|hl6050|Brother HL6050:\
>> :lp=:rm=hl6050.lan:\
>> :if=/home/jaj/bin/printbrother.sh:\
>> :sh:
>>
>> mg3150|canon|Canon MG3150:\
>> :lp=:rm=canon.lan:\
>> :if=/home/jaj/bin/printcanon.sh:\
>> :sh:
>>
>> Here is the content of printcanon.sh:
>> #!/bin/sh
>>
>> logger "printcanon called $@"
>>
>> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
>> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
>> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
>>
>> printbrother.sh is the same except for driver and ppd.
>> Both scripts are executable.
>> I never see the "printcanon called" message in syslog and the printers
>> get incorrect data. The first printer understands a subset of
>> postscript so it prints fine, the second printer however does not.
>> If I run a document manually through the filter and the enqueue it to
>> lpr, the printers are more than happy to print.
>>
>> I see no error nowhere.
>>
>> $ cat /var/log/lpd-errs
>> Oct 25 07:47:01 asterix lpd[9652]: restarted
>> Oct 25 14:57:06 asterix lpd[17953]: restarted
>>
>> $ cat /var/spool/output/lpd/status
>> sending to hl6050.lan
>>
>> I went through the code of lpd to see where things could go wrong but
>> it's a bit complex and I couldn't understand the bits.
>>
>> Does anybody know where I could look to solve this?
>>
>> Best regards,
>> Jona
>>
>>
>
> Does the lpd user have permission to run those scripts? Maybe run lpd
> under ktrace -i for more clues. lpd filters definitely worked in -current
> as of April because I was using them for the music queue at p2k15.

I found out that it is related to using 'rm' instead of 'lp'. It
executes filters if I set lp=5...@hl6050.lan. It does not if I set
rm=hl6050.lan.



Re: LPR/LPD does not run filters

2015-10-27 Thread Jona Joachim
On 2015-10-27, Stuart Henderson  wrote:
> On 2015-10-25, Jona Joachim  wrote:
>> Hi, 
>> I was tired of CUPS so I decided keep it simple and stupid and use
>> lpd/lpr. Strangely, things don't work out as expected. It seems that
>> lpd never executes input filters.
>>
>> Here is the content of /etc/printcap:
>> lp|hl6050|Brother HL6050:\
>> :lp=:rm=hl6050.lan:\
>> :if=/home/jaj/bin/printbrother.sh:\
>> :sh:
>>
>> mg3150|canon|Canon MG3150:\
>> :lp=:rm=canon.lan:\
>> :if=/home/jaj/bin/printcanon.sh:\
>> :sh:
>>
>> Here is the content of printcanon.sh:
>> #!/bin/sh
>>
>> logger "printcanon called $@"
>>
>> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
>> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
>> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
>>
>> printbrother.sh is the same except for driver and ppd.
>> Both scripts are executable.
>> I never see the "printcanon called" message in syslog and the printers
>> get incorrect data. The first printer understands a subset of
>> postscript so it prints fine, the second printer however does not.
>> If I run a document manually through the filter and the enqueue it to
>> lpr, the printers are more than happy to print.
>>
>> I see no error nowhere.
>>
>> $ cat /var/log/lpd-errs
>> Oct 25 07:47:01 asterix lpd[9652]: restarted
>> Oct 25 14:57:06 asterix lpd[17953]: restarted
>>
>> $ cat /var/spool/output/lpd/status
>> sending to hl6050.lan
>>
>> I went through the code of lpd to see where things could go wrong but
>> it's a bit complex and I couldn't understand the bits.
>>
>> Does anybody know where I could look to solve this?
>>
>> Best regards,
>> Jona
>>
>>
>
> Does the lpd user have permission to run those scripts? Maybe run lpd
> under ktrace -i for more clues. lpd filters definitely worked in -current
> as of April because I was using them for the music queue at p2k15.

Well, specifying 'lp' instead of 'rm' does make it run filters, but the job
is not sent to the printer, even when I use the port@host format from
the man page. As soon as I set 'rm', filters are no longer executed.



Re: LPR/LPD does not run filters

2015-10-27 Thread Stuart Henderson
On 2015-10-25, Jona Joachim  wrote:
> Hi, 
> I was tired of CUPS so I decided keep it simple and stupid and use
> lpd/lpr. Strangely, things don't work out as expected. It seems that
> lpd never executes input filters.
>
> Here is the content of /etc/printcap:
> lp|hl6050|Brother HL6050:\
> :lp=:rm=hl6050.lan:\
> :if=/home/jaj/bin/printbrother.sh:\
> :sh:
>
> mg3150|canon|Canon MG3150:\
> :lp=:rm=canon.lan:\
> :if=/home/jaj/bin/printcanon.sh:\
> :sh:
>
> Here is the content of printcanon.sh:
> #!/bin/sh
>
> logger "printcanon called $@"
>
> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
>
> printbrother.sh is the same except for driver and ppd.
> Both scripts are executable.
> I never see the "printcanon called" message in syslog and the printers
> get incorrect data. The first printer understands a subset of
> postscript so it prints fine, the second printer however does not.
> If I run a document manually through the filter and the enqueue it to
> lpr, the printers are more than happy to print.
>
> I see no error nowhere.
>
> $ cat /var/log/lpd-errs
> Oct 25 07:47:01 asterix lpd[9652]: restarted
> Oct 25 14:57:06 asterix lpd[17953]: restarted
>
> $ cat /var/spool/output/lpd/status
> sending to hl6050.lan
>
> I went through the code of lpd to see where things could go wrong but
> it's a bit complex and I couldn't understand the bits.
>
> Does anybody know where I could look to solve this?
>
> Best regards,
> Jona
>
>

Does the lpd user have permission to run those scripts? Maybe run lpd
under ktrace -i for more clues. lpd filters definitely worked in -current
as of April because I was using them for the music queue at p2k15.



Re: LPR/LPD does not run filters

2015-10-25 Thread Andy Bradford
Thus said Jona Joachim on Sun, 25 Oct 2015 15:11:01 +0100:

> I was  tired of CUPS so  I decided keep  it simple and stupid  and use
> lpd/lpr. Strangely, things  don't work out as expected.  It seems that
> lpd never executes input filters.

I have a system  running standard lpd on OpenBSD 5.3  which works with a
filter. I have:

lp|parallel:\
:lp=/dev/lpa0:\
:br#57600:\
:rm=:\
:rp=:\
:mx#0:\
:sd=/var/spool/output/parallel:\
:lf=/var/log/lpd-errs:\
:sh:\
:if=/var/spool/output/parallel/filter

So at least as of OpenBSD 5.3 filters worked just find with the standard
lpd. I cannot say  for newer versions as I have not  yet upgraded, but I
don't know why it should cease to work.

Andy
-- 
TAI64 timestamp: 4000562d5f56



Re: LPR/LPD does not run filters

2015-10-25 Thread Jona Joachim
On 2015-10-25, Predrag Punosevac  wrote:
>> Hi, 
>> I was tired of CUPS so I decided keep it simple and stupid and use
>> lpd/lpr. Strangely, things don't work out as expected. It seems that
>> lpd never executes input filters.
>> 
>> Here is the content of /etc/printcap:
>> lp|hl6050|Brother HL6050:\
>> :lp=:rm=hl6050.lan:\
>> :if=/home/jaj/bin/printbrother.sh:\
>> :sh:
>> 
>> mg3150|canon|Canon MG3150:\
>> :lp=:rm=canon.lan:\
>> :if=/home/jaj/bin/printcanon.sh:\
>> :sh:
>> 
>> Here is the content of printcanon.sh:
>> #!/bin/sh
>> 
>> logger "printcanon called $@"
>> 
>> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
>> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
>> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
>> 
>> printbrother.sh is the same except for driver and ppd.
>> Both scripts are executable.
>> I never see the "printcanon called" message in syslog and the printers
>> get incorrect data. The first printer understands a subset of
>> postscript so it prints fine, the second printer however does not.
>> If I run a document manually through the filter and the enqueue it to
>> lpr, the printers are more than happy to print.
>> 
>> I see no error nowhere.
>> 
>> $ cat /var/log/lpd-errs
>> Oct 25 07:47:01 asterix lpd[9652]: restarted
>> Oct 25 14:57:06 asterix lpd[17953]: restarted
>> 
>> $ cat /var/spool/output/lpd/status
>> sending to hl6050.lan
>> 
>> I went through the code of lpd to see where things could go wrong but
>> it's a bit complex and I couldn't understand the bits.
>> 
>> Does anybody know where I could look to solve this?
>> 
>> Best regards,
>> Jona
>> 
>
> Have you checked ports mailing list? I posted this about a year ago.
>
>
> I know that many people were very frustrated when upstream broke
> foomatic-rip for LPD users. Thanks to Antoine Jacoutot many of us will
> be CUPS free for years to come. I am leaving internet trace for people
> who would be looking for the info but Antoine documentation
>
> /usr/local/share/doc/pkg-readmes/cups-filters-1.0.54p2
>
> is golden standard.
>
> In the nut shell what I did:

Yes, you did exactly the same as me.



Re: LPR/LPD does not run filters

2015-10-25 Thread Predrag Punosevac
> Hi, 
> I was tired of CUPS so I decided keep it simple and stupid and use
> lpd/lpr. Strangely, things don't work out as expected. It seems that
> lpd never executes input filters.
> 
> Here is the content of /etc/printcap:
> lp|hl6050|Brother HL6050:\
> :lp=:rm=hl6050.lan:\
> :if=/home/jaj/bin/printbrother.sh:\
> :sh:
> 
> mg3150|canon|Canon MG3150:\
> :lp=:rm=canon.lan:\
> :if=/home/jaj/bin/printcanon.sh:\
> :sh:
> 
> Here is the content of printcanon.sh:
> #!/bin/sh
> 
> logger "printcanon called $@"
> 
> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
> 
> printbrother.sh is the same except for driver and ppd.
> Both scripts are executable.
> I never see the "printcanon called" message in syslog and the printers
> get incorrect data. The first printer understands a subset of
> postscript so it prints fine, the second printer however does not.
> If I run a document manually through the filter and the enqueue it to
> lpr, the printers are more than happy to print.
> 
> I see no error nowhere.
> 
> $ cat /var/log/lpd-errs
> Oct 25 07:47:01 asterix lpd[9652]: restarted
> Oct 25 14:57:06 asterix lpd[17953]: restarted
> 
> $ cat /var/spool/output/lpd/status
> sending to hl6050.lan
> 
> I went through the code of lpd to see where things could go wrong but
> it's a bit complex and I couldn't understand the bits.
> 
> Does anybody know where I could look to solve this?
> 
> Best regards,
> Jona
> 

Have you checked ports mailing list? I posted this about a year ago.


I know that many people were very frustrated when upstream broke
foomatic-rip for LPD users. Thanks to Antoine Jacoutot many of us will
be CUPS free for years to come. I am leaving internet trace for people
who would be looking for the info but Antoine documentation

/usr/local/share/doc/pkg-readmes/cups-filters-1.0.54p2

is golden standard.

In the nut shell what I did:

0. Install foomatic-rip, drivers (in my case hpijs), a2ps, ImageMagick

1. Edit /etc/printcap as
lp|HP|HP-PhotoSmart_C5200:\
:lp=/dev/ulpt0:\
:if=/etc/foomatic-rip/script.sh:\
:sh:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:

2. Create /etc/foomatic-rip.script.sh and make it executable

#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P HP-PhotoSmart_C5200 --ppd \
/etc/foomatic-rip/direct/hp-photosmart_c5200_series-hpijs.ppd

3. Add hp-photosmart_c5200_series-hpijs.ppd to /etc/foomatic-rip/direct

4. Adjust permission on ulpt0 and ugen devices. 

5. Start lpd daemon and be happy camper.

Cheers,
Predrag



Re: LPR/LPD does not run filters

2015-10-25 Thread Steve Litt
On Sun, 25 Oct 2015 15:11:01 +0100
Jona Joachim  wrote:

> Hi, 
> I was tired of CUPS so I decided keep it simple and stupid and use
> lpd/lpr. Strangely, things don't work out as expected. It seems that
> lpd never executes input filters.
> 
> Here is the content of /etc/printcap:
> lp|hl6050|Brother HL6050:\
> :lp=:rm=hl6050.lan:\
> :if=/home/jaj/bin/printbrother.sh:\
> :sh:
> 
> mg3150|canon|Canon MG3150:\
> :lp=:rm=canon.lan:\
> :if=/home/jaj/bin/printcanon.sh:\
> :sh:
> 
> Here is the content of printcanon.sh:
> #!/bin/sh
> 
> logger "printcanon called $@"
> 
> /usr/local/bin/a2ps -BRq --columns=1 -o - | \
> /usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
> --ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd
> 
> printbrother.sh is the same except for driver and ppd.
> Both scripts are executable.
> I never see the "printcanon called" message in syslog and the printers
> get incorrect data. The first printer understands a subset of
> postscript so it prints fine, the second printer however does not.
> If I run a document manually through the filter and the enqueue it to
> lpr, the printers are more than happy to print.
> 
> I see no error nowhere.
> 
> $ cat /var/log/lpd-errs
> Oct 25 07:47:01 asterix lpd[9652]: restarted
> Oct 25 14:57:06 asterix lpd[17953]: restarted
> 
> $ cat /var/spool/output/lpd/status
> sending to hl6050.lan
> 
> I went through the code of lpd to see where things could go wrong but
> it's a bit complex and I couldn't understand the bits.
> 
> Does anybody know where I could look to solve this?
> 
> Best regards,
> Jona
> 

What little I ever knew about LPRng has vanished from my memory, but I
have some suggestions.

Before anything else, back up your existing /etc/printcap so you can
experiment to your heart's content and still go back to what you have.

Next, just for fun, use the ps command to verify that lpd is running
in the background. Better yet, kill the background lpd, run it in the
foreground, and watch the messages it scrolls.

Create a new printcap, with exactly one printer, lp_test, that's
the simplest possible printer queue. If possible, give it only one
property: an if script that prints a timestamp and then the contents of
the document to /tmp/junk.log.

If in fact the prior two mentioned tests support your findings that lpd
never runs the stuff in printcap at all, experiment with printcap
permissions. Also, now that you're running lpd in the foreground on a
command prompt, experiment with different options to the lpd command.

In your description, you say input filters are never executed, and
later says that you never seethe "printcanon called". If you ever see
"printbrother called", then you can exploit the differences by changing
the two print queues to ever more resemble each other, until either
both malfunction in the same way, or both work. At that point, you know
what you did to flip the symptom.

HTH,

SteveT

Steve Litt 
October 2015 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive



LPR/LPD does not run filters

2015-10-25 Thread Jona Joachim
Hi, 
I was tired of CUPS so I decided keep it simple and stupid and use
lpd/lpr. Strangely, things don't work out as expected. It seems that
lpd never executes input filters.

Here is the content of /etc/printcap:
lp|hl6050|Brother HL6050:\
:lp=:rm=hl6050.lan:\
:if=/home/jaj/bin/printbrother.sh:\
:sh:

mg3150|canon|Canon MG3150:\
:lp=:rm=canon.lan:\
:if=/home/jaj/bin/printcanon.sh:\
:sh:

Here is the content of printcanon.sh:
#!/bin/sh

logger "printcanon called $@"

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -q -P Canon-PIXMA-MG3150 \
--ppd /home/jaj/bin/Canon-PIXMA-MG3150-ijs-simplified.ppd

printbrother.sh is the same except for driver and ppd.
Both scripts are executable.
I never see the "printcanon called" message in syslog and the printers
get incorrect data. The first printer understands a subset of
postscript so it prints fine, the second printer however does not.
If I run a document manually through the filter and the enqueue it to
lpr, the printers are more than happy to print.

I see no error nowhere.

$ cat /var/log/lpd-errs
Oct 25 07:47:01 asterix lpd[9652]: restarted
Oct 25 14:57:06 asterix lpd[17953]: restarted

$ cat /var/spool/output/lpd/status
sending to hl6050.lan

I went through the code of lpd to see where things could go wrong but
it's a bit complex and I couldn't understand the bits.

Does anybody know where I could look to solve this?

Best regards,
Jona