Trouble with lpr and Brother wireless printer

2022-07-30 Thread Ben Hancock
Hi all,

I'm having trouble getting printing to work using lpr(1) and a
Brother wireless printer[1] that should support it. This seems to
be a perennial topic on the list, but despite trying what I've found
in the archives, I'm stumped.

Here's my /etc/printcap:

lp|brother:\
:rm=192.168.xxx.xxx:\
:rp=brother:\
:sd=/var/spool/output/lpd:\
:lf=/var/log/lpd-errs:

(The `xxx`s are, of course, actually digits).

But entering `$ lpr filename.ps` does nothing. The printer remains
quiet. Nothing shows up in the queue. `lpq` gives this output:

Printer Name: brother
Jobs: No Jobs in Queue

The output of `lpc status` is similarly unremarkable:

lp:
queuing is enabled
printing is enabled
no entries
printer idle

My permissions also seem fine:

$ ls -la /var/spool/output
total 12
drwxr-xr-x  3 root  wheel   512 Jul 30 14:24 .
drwxr-xr-x  6 root  wheel   512 Apr 11 16:45 ..
drwxrwx---  2 root  daemon  512 Jul 30 20:21 lpd

Oddly, if I attempt to print something from Firefox, using the
system dialog and setting lpr as the printer, the printer wakes up
and starts spewing out blank sheets until I manually cancel it using
the power button on the printer. So it seems that the issue is not
connecting to the printer, but how I am invoking lpr ... maybe?

What am I overlooking?

- Ben

[1] https://www.brother-usa.com/products/hll2350dw



Trouble with lpr and Brother wireless printer

2022-07-31 Thread B. Atticus Grobe
I use an HL-L2370DW which only accepts PCL on BINARY_P1.
I think it likely that yours acts the same. You'll have to tell lp to send
the output through a filter, using (iirc) the vf= option in printcap.
This is what i used for a filter:

#!/bin/sh
gs -sPAPERSIZE=letter -sDEVICE=pxlmono -sOutputFile=- -dBATCH -dNOPAUSE -

Hope this helps.


Re: Trouble with lpr and Brother wireless printer

2022-07-31 Thread John Mettraux


On Sat, Jul 30, 2022 at 08:40:59PM -0700, Ben Hancock wrote:
>
> Here's my /etc/printcap:
>
> lp|brother:\
> :rm=192.168.xxx.xxx:\
> :rp=brother:\
> :sd=/var/spool/output/lpd:\
> :lf=/var/log/lpd-errs:

Hello,

Brother MFC-L3770CDW wireless here.

My /etc/printcap goes:

lp:\
  sd=/var/spool/lpd:lp=:rm=192.168.xxx.xxx:rp=BINARY_P1

Maybe it will help.


Best regards,

John



Re: Trouble with lpr and Brother wireless printer

2022-07-31 Thread Ben Hancock
On Sun, 31 Jul 2022 19:10:08 +0900
John Mettraux  wrote:
> Brother MFC-L3770CDW wireless here.
> 
> My /etc/printcap goes:
> 
> lp:\
>   sd=/var/spool/lpd:lp=:rm=192.168.xxx.xxx:rp=BINARY_P1
> 
> Maybe it will help.

Thanks very much John. I wasn't aware of the BINARY_P1 service option,
which I found documented in a Brother Network Users Manual[1] after
reading your mail, so thank you for suggesting that. However, trying
this was unsuccessful for me, so I'm afraid I'm still stuck.

- Ben

[1] 
https://www.brother-usa.com/virdata/content/en-us/printers/consumer/networkusersmanual/num_hl_1270n_en_1310.pdf



Re: Trouble with lpr and Brother wireless printer

2022-07-31 Thread Jan Stary
Seriously, get a printer that speaks PostScript and PDF.
These exist, and are not too expensive. The just say

lp::lp=:rm=aa.bb.cc.dd:rp=lp:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:sh:


On Jul 31 13:34:18, grobe...@gmail.com wrote:
> I use an HL-L2370DW which only accepts PCL on BINARY_P1.
> I think it likely that yours acts the same. You'll have to tell lp to send
> the output through a filter, using (iirc) the vf= option in printcap.
> This is what i used for a filter:
> 
> #!/bin/sh
> gs -sPAPERSIZE=letter -sDEVICE=pxlmono -sOutputFile=- -dBATCH -dNOPAUSE -
> 
> Hope this helps.
> 



Re: Trouble with lpr and Brother wireless printer

2022-08-01 Thread Stuart Henderson
On 2022-07-31, John Mettraux  wrote:
>
> On Sat, Jul 30, 2022 at 08:40:59PM -0700, Ben Hancock wrote:
>>
>> Here's my /etc/printcap:
>>
>> lp|brother:\
>> :rm=192.168.xxx.xxx:\
>> :rp=brother:\
>> :sd=/var/spool/output/lpd:\
>> :lf=/var/log/lpd-errs:
>
> Hello,
>
> Brother MFC-L3770CDW wireless here.
>
> My /etc/printcap goes:
>
> lp:\
>   sd=/var/spool/lpd:lp=:rm=192.168.xxx.xxx:rp=BINARY_P1
>
> Maybe it will help.

Also try POSTSCRIPT_P1, my MFC-J4335DW shows that as a possibility
in Network > Network > Service. (I use it with CUPS though, so I can
control quality/duplexing/etc).


-- 
Please keep replies on the mailing list.



Re: Trouble with lpr and Brother wireless printer

2022-08-01 Thread Ben Hancock
On Mon, 1 Aug 2022 07:50:19 - (UTC)
Stuart Henderson  wrote:
> On 2022-07-31, John Mettraux  wrote:
> > Brother MFC-L3770CDW wireless here.
> >
> > My /etc/printcap goes:
> >
> > lp:\
> >   sd=/var/spool/lpd:lp=:rm=192.168.xxx.xxx:rp=BINARY_P1
> >
> > Maybe it will help.  
> 
> Also try POSTSCRIPT_P1, my MFC-J4335DW shows that as a possibility
> in Network > Network > Service. (I use it with CUPS though, so I can
> control quality/duplexing/etc).

Thanks for all the helpful suggestions. I took some time to explore the
web interface for my printer (a Brother HL-L2350DW, for those following
along at home) and discovered the BINARY_P1, POSTSCRIPT_P1, PCL_P1, and
TEXT_P1 services available. But thus far, none of them have worked for
me -- with or without passing the data through a filter, as suggested
earlier in the thread.

I did make some changes to my printcap that seemed to take me in the
direction of progress, notably to stop passing the printer host to the
`rm` option and instead try passing port@host to the `lp` option. (I
also added an /etc/hosts entry for ease). I did this after noticing that
POSTSCRIPT_P1 and the other services were listed as being available on
port 9100. So here's one test case:

pstest:\
:lp=9...@brother.sannomo.home:\
:rp=POSTSCRIPT_P1:\
:sd=/var/spool/output/lpd:\
:lf=/var/log/lpd-errs:\
:mx#0:
:sh:

But no dice. When invoking `lpr filename.ps`, I consistently get a
single blank page spit out from the printer and that's it. It's more
than, well, nothing ... but it's unfortunately not printing. I also
tried just sending a text file to the printer directly with nc(1); it
showed "Receiving Data" on the printer LCD, but nothing more.
Strangely (maybe?) I had to Ctrl-C out of netcat as doing ...

$ nc brother.sannomo.home 9100 < test.txt

... just hung there.

FWIW, I do know that the printer _works_, as I can print from machines
running other OS'es via the usual ways. I don't seem to be the only one
banging my face into a wall with this. I found an old thread on
DaemonForums describing an issue with similar symptoms that was, it
seems, ultimately unresolved:

http://daemonforums.org/showthread.php?t=7253

Something I haven't tried -- thought I don't know if it will make a
difference -- is connecting to the printer via WiFi Direct. This
doesn't seem to be a connection issue though. I'm on the verge of just
trying CUPS, although it seems to be much bemoaned.

Thanks again.

- Ben



Re: Trouble with lpr and Brother wireless printer

2022-08-01 Thread gwes




On 8/2/22 00:16, Ben Hancock wrote:

On Mon, 1 Aug 2022 07:50:19 - (UTC)
Stuart Henderson  wrote:

On 2022-07-31, John Mettraux  wrote:

Brother MFC-L3770CDW wireless here.

My /etc/printcap goes:

lp:\
   sd=/var/spool/lpd:lp=:rm=192.168.xxx.xxx:rp=BINARY_P1

Maybe it will help.

Also try POSTSCRIPT_P1, my MFC-J4335DW shows that as a possibility
in Network > Network > Service. (I use it with CUPS though, so I can
control quality/duplexing/etc).

Thanks for all the helpful suggestions. I took some time to explore the
web interface for my printer (a Brother HL-L2350DW, for those following
along at home) and discovered the BINARY_P1, POSTSCRIPT_P1, PCL_P1, and
TEXT_P1 services available. But thus far, none of them have worked for
me -- with or without passing the data through a filter, as suggested
earlier in the thread.

I did make some changes to my printcap that seemed to take me in the
direction of progress, notably to stop passing the printer host to the
`rm` option and instead try passing port@host to the `lp` option. (I
also added an /etc/hosts entry for ease). I did this after noticing that
POSTSCRIPT_P1 and the other services were listed as being available on
port 9100. So here's one test case:

pstest:\
 :lp=9...@brother.sannomo.home:\
 :rp=POSTSCRIPT_P1:\
 :sd=/var/spool/output/lpd:\
 :lf=/var/log/lpd-errs:\
 :mx#0:
 :sh:

But no dice. When invoking `lpr filename.ps`, I consistently get a
single blank page spit out from the printer and that's it. It's more
than, well, nothing ... but it's unfortunately not printing. I also
tried just sending a text file to the printer directly with nc(1); it
showed "Receiving Data" on the printer LCD, but nothing more.
Strangely (maybe?) I had to Ctrl-C out of netcat as doing ...

$ nc brother.sannomo.home 9100 < test.txt

... just hung there.

FWIW, I do know that the printer _works_, as I can print from machines
running other OS'es via the usual ways. I don't seem to be the only one
banging my face into a wall with this. I found an old thread on
DaemonForums describing an issue with similar symptoms that was, it
seems, ultimately unresolved:

http://daemonforums.org/showthread.php?t=7253

Something I haven't tried -- thought I don't know if it will make a
difference -- is connecting to the printer via WiFi Direct. This
doesn't seem to be a connection issue though. I'm on the verge of just
trying CUPS, although it seems to be much bemoaned.

Thanks again.

- Ben


Are you sure that you're feeding the printer a valid postscript file?
If there isn't something like
(TimesRoman) findfont 48 scalefont setfont 200 300 moveto (text) show 
showpage

nothing happens.
geoff steckel



Re: Trouble with lpr and Brother wireless printer

2022-08-01 Thread Stuart Henderson
On 2022-08-02, Ben Hancock  wrote:
> FWIW, I do know that the printer _works_, as I can print from machines
> running other OS'es via the usual ways.

One thing you could try is doing a packet capture on a working
OS (e.g. with wireshark) and compare with what you're sending from lpr.

> I'm on the verge of just
> trying CUPS, although it seems to be much bemoaned.

Certainly worth a try.

-- 
Please keep replies on the mailing list.



Re: Trouble with lpr and Brother wireless printer

2022-08-02 Thread Ben Hancock
On Tue, 2 Aug 2022 02:09:37 -0400
gwes  wrote:

> Are you sure that you're feeding the printer a valid postscript file?
> If there isn't something like
> (TimesRoman) findfont 48 scalefont setfont 200 300 moveto (text) show 
> showpage
> nothing happens.

I believe so. The two samples I've tried were generated with man and
enscript. I can open them both fine with ghostscript and zathura.

- Ben



Re: Trouble with lpr and Brother wireless printer

2022-08-02 Thread Sean Kamath
The shortest postscript I know to test a printer:

%!
newpath clippath stroke showpage

It will draw a line around the page clipping path (i.e., the outer most edge 
the printer can print at).

Sean

PS That’s also short enough to type at a printer if you connect to it with 
’nc’. :-)

> On Aug 2, 2022, at 06:11, Ben Hancock  wrote:
> 
> On Tue, 2 Aug 2022 02:09:37 -0400
> gwes  wrote:
> 
>> Are you sure that you're feeding the printer a valid postscript file?
>> If there isn't something like
>> (TimesRoman) findfont 48 scalefont setfont 200 300 moveto (text) show 
>> showpage
>> nothing happens.
> 
> I believe so. The two samples I've tried were generated with man and
> enscript. I can open them both fine with ghostscript and zathura.
> 
> - Ben



Re: Trouble with lpr and Brother wireless printer

2022-08-04 Thread Ben Hancock
Boy, I went down the rabbit hole on this one. I'll spare the list
all the gory details, but for the sake of posterity I figured I'll
try to close the loop on this thread.

To make a long story short: After failing to get the printer working
with just regular lpr, I tried CUPS to no avail. Along the way,
however, I discovered a Perl script in a Linux package available
on Brother's website that ostensibly could have served as an input
filter for lpr (called, somewhat obviously, `lpdfilter`). After a
bit of searching, I found a related thread [1] on a FreeBSD list
and made some edits to this script, hoping that it would be the trick.

Where I hit a wall was with a binary (also included in the package)
called `rawtobr3`, that the Perl script expected. It appears to be
proprietary Brother stuff and kept throwing an error, probably
because it was built for Linux and not BSD. I did find a GitHub
repo via a FreeBSD forum thread [2] that seemed to include _some_
version of this program, but it threw another error and the filter
did not work.

So, to wrap up: I do not recommend the Brother HLL2350DW for your
OpenBSD printing needs. I may end up heeding the suggestions to
simply buy a printer that speaks PostScript. Recommendations welcome.

- Ben

[1] https://lists.freebsd.org/pipermail/freebsd-questions/2017-July/277994.html

[2] https://forums.freebsd.org/threads/port-for-brother-printer-drivers.78393/



Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread Jan Stary
On Aug 04 21:27:09, b...@benghancock.com wrote:
> So, to wrap up: I do not recommend the Brother HLL2350DW for your
> OpenBSD printing needs. I may end up heeding the suggestions to
> simply buy a printer that speaks PostScript. Recommendations welcome.

I bought an HP LaserJet M608 for peanuts, works without any fuss as
lp::lp=:rm=pr.stare.cz:rp=lp:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:sh:

Jan



Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread Sean Kamath
> On Aug 4, 2022, at 21:27, Ben Hancock  wrote:
> 
> So, to wrap up: I do not recommend the Brother HLL2350DW for your
> OpenBSD printing needs. I may end up heeding the suggestions to
> simply buy a printer that speaks PostScript. Recommendations welcome.

HP used to make freakin’ tanks, and I had a LasterJet 4MV or 4M+for something 
close to 15 years.  Bought it rebuilt (AFTER they stopped manufacturing it). 
:-). I can’t speak to anything they produced after 2005, though.

I’ve been extremely happy with my Canon — but I don’t use it from OpenBSD 
(though someday I will get around to it).  They make engines that a lot of 
other companies use.

I used to subscribe to the idea that buying a used “enterprise” printer was 
ideal (hence the used HPs — I had two, they both were awesome), but I’ve been 
seduced by short click-to-clack times.

What I still believe: Get a printer that does one thing: Print.  No gizmofrobs 
or wingdings.  And get a laser printer.  Ink is a nightmare.

Sean

PS I used to work at a printer company (actually two).  I used to know a LOT 
about printers (particularly PostScript printers).  I don’t anymore (I’ve been 
out of that space for . . . wow.  18 years now. . .).  It wasn’t HP.



Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread Ryan Freeman
On Thu, Aug 04, 2022 at 09:27:09PM -0700, Ben Hancock wrote:
> Boy, I went down the rabbit hole on this one. I'll spare the list
> all the gory details, but for the sake of posterity I figured I'll
> try to close the loop on this thread.
> 
> To make a long story short: After failing to get the printer working
> with just regular lpr, I tried CUPS to no avail. Along the way,

Did you happen to try CUPS with the brlaser package installed?
I have a Brother HL-L2390DW, and once I found brlaser it just worked.

-Ryan

> however, I discovered a Perl script in a Linux package available
> on Brother's website that ostensibly could have served as an input
> filter for lpr (called, somewhat obviously, `lpdfilter`). After a
> bit of searching, I found a related thread [1] on a FreeBSD list
> and made some edits to this script, hoping that it would be the trick.
> 
> Where I hit a wall was with a binary (also included in the package)
> called `rawtobr3`, that the Perl script expected. It appears to be
> proprietary Brother stuff and kept throwing an error, probably
> because it was built for Linux and not BSD. I did find a GitHub
> repo via a FreeBSD forum thread [2] that seemed to include _some_
> version of this program, but it threw another error and the filter
> did not work.
> 
> So, to wrap up: I do not recommend the Brother HLL2350DW for your
> OpenBSD printing needs. I may end up heeding the suggestions to
> simply buy a printer that speaks PostScript. Recommendations welcome.
> 
> - Ben
> 
> [1] 
> https://lists.freebsd.org/pipermail/freebsd-questions/2017-July/277994.html
> 
> [2] https://forums.freebsd.org/threads/port-for-brother-printer-drivers.78393/
> 



Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread Stuart Henderson
On 2022-08-05, Sean Kamath  wrote:
> What I still believe: Get a printer that does one thing: Print.  No 
> gizmofrobs or wingdings.  And get a laser printer.  Ink is a nightmare.

OTOH I'm very happy with my Brother MFC-J4335DW inkjet. I haven't
got scanning to work from OpenBSD but that works from my phone and
non-OpenBSD boxes (and I mostly wanted that for making quick copies
anyway). Printing via CUPS works great, ink is not ridiculously priced,
duplexing works properly, doesn't take up too much space, etc.




Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread B. Atticus Grobe
I'm sorry the filter didn't work for you. I'm not using OpenBSD as a
desktop right now, but I abused my router a bit to test, and can confirm
that with an HL-L2370DW, the following printcap entry works, along with
the filter. I know you've basically already moved on, but if you feel like
giving it a try again, here's at least something. I can't remember if I
mentioned it, but the filter does require ghostscript to be installed.

I'm not sure exactly how you're trying to print or from what, but this
printed a standard PDF file using `lpr file.pdf' without issue.

/etc/printcap:
lp|HLL2370DW:\
:lp=:rm=printer.localdomain:rp=BINARY_P1:sd=/var/spool/output/lpd:\
:lf=/var/log/lpd-errs:of=/usr/bin/pclfilter


/usr/bin/pclfilter:
#!/bin/sh

gs -sPAPERSIZE=letter -sDEVICE=pxlmono -sOutputFile=- -dBATCH -dNOPAUSE
-dQUIET -



Re: Trouble with lpr and Brother wireless printer

2022-08-05 Thread Ben Hancock
On Fri, 5 Aug 2022 00:05:29 -0700
Ryan Freeman  wrote:
> Did you happen to try CUPS with the brlaser package installed?
> I have a Brother HL-L2390DW, and once I found brlaser it just worked.

You, sir, are a saint. It works!! I can't believe I didn't manage to
find that package (((facepalm))).

So I'll amend my report: 
Brother HL-L2350DW works fine with cups and brlaser

Thanks all for the kind help.

- Ben