Solved Problems bringing up lp (Brother_HL_L2405W_USB)

Hi --

I'm having basic problems getting printing to go, certainly I'm overlooking something simple. I'm using the Handbook ch. 11 PRINTING page for setup (though I see there's a separate CUPS page; later on that)

Printer is a Brother HL-L2405W, connected via USB. It enumerates OK, dmesg reports it as described. It shows up as /dev/unlpt0. If I do $ ls > /dev/unlpt0 the printer LCD shows "receiving data" but it does not print, but I assume that's a data-format problem (eg. not postscript etc)(NOTE 1).

My /etc/printcap contains:
Code:
lp|Brother_HL_L2405W_USB:\
  lp=/dev/unlpt0:\
  rp=raw:\
  sh:\
  mx#0:\
  sd=/var/spool/lpd/lp:\
  lf=/var/log/lpd-errs:

chkprintcap does not complain.

FIRST PROBLEM:

$ ls | lpr says lpr: Error - No default destination. This I assume is my gatewaying problem.

I've installed CUPS, I assume it uses lp to queue things. lpinfo displays nil (no display).

PROBABLY BAD ASSSUMPTIONS:

NOTE 1: ... that the Brother HL-L2405W is a postscript printer, or otherwise compatible.

-------------------

PROBABLY RELATED:

The CUPS config wants me to create a rule set in /etc/devfs.rules based upon dmesg results. It all makes sense except for this NOTE:

Code:
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/X.Y.Z' mode 0660 group cups

Note that X, Y, and Z should be replaced with the target USB device listed in the /dev/usb directory that corresponds to the printer.To find the correct device, examine the output of dmesg(8), where ugenX.Y lists the printer device, which is a symbolic link to a USB device in /dev/usb.

OK, I can see that ugen0.7 creates devices /dev/usb/0.7.1 through 0.7.8. So X=0, Y=7, ... what's Z?
 
If you are (or want to) work with cups from the command line, first make sure you are using the correct lp* utils (lpr etc). The ones delivered with FreeBSD base are not CUPS.
Example:
Code:
root@kg-core2:~ # which lpr
/usr/bin/lpr
root@kg-core2:~ # ls -l /usr/local/bin/lpr
-rwxr-xr-x  1 root wheel 14376 Oct 20 03:14 /usr/local/bin/lpr
root@kg-core2:~ # lpr --version
lpr: Bad argument to -i, number expected
root@kg-core2:~ # /usr/local/bin/lpr --version
/usr/local/bin/lpr: Error - unknown option "-".
 
If you are (or want to) work with cups from the command line, first make sure you are using the correct lp* utils (lpr etc). The ones delivered with FreeBSD base are not CUPS.
Right. My bad. Firefox needs gtk3 which needs cups. I'll use lpr and lpq etc from /usr/bin for testing. Window manager is ctwm.

I set cupsd_enable to NO, stopped the daemon. Power-cycled the printer in case it was filled with nonsense from testing.

After a reboot /usr/bin/lp* no longer complains of no default printer.

Code:
tomj@lab:~$ sudo ls -la /var/spool/lpd/lp/
drwxrwx---  2 daemon daemon 2 Nov 24 10:38 .
drwxr-xr-x  3 root   daemon 3 Nov 24 10:38 ..

dmesg says

Code:
ugen0.2: <Brother HL-L2405W> at usbus0
ulpt0 on uhub0
ulpt0: <Brother HL-L2405W, class 0/0, rev 2.00/1.00, addr 21> on usbus0
ulpt0: using bi-directional mode

I admit it has been some time since I've set up lpd. rc.conf contains lpd_enabled="YES", the daemon is running (/usr/sbin/lpd), the queue dir seems correct.

The unlpt0 and ulpt0 devices "look correct" and copying data to the raw device (/dev/unlpt0) and the printer says "receiving data", but does not print.

ls | /usr/bin/lpr offers no complaint; and /usr/bin/lpq shows the job queued. But it never drains.

However /etc/hosts.lpd contains nothing (comment) should it have + or localhost or 127.0.0.1 in it? (default file i github is what I've got).

I admit I'm kinda stumped.

Go to http://localhost:631 in your web browser, open the Printers tab, select your printer, and choose Print Test Page from the Maintenance menu.

With CUPS daemon not running firefox says "can't connect", as expected.
 
/usr/bin/lpr
is the native print spooler for FreeBSD

/usr/local/bin/lpr

is CUPS.

To start with the HL-2405W is near the bottom of the 2400 series and likely uses a gdi driver rather than PCL6. The HL-2460 has PCL6 emulation
See "Printer Specifications" at this link.

There is a good chance that the
print/brlaser driver will support your printer but it will take some creative print filters to get it to work with FreeBSD's lpr spooler. I used the following terms in google AI: "can you use brlaser as a print filter in lpr printing" and got this output:
2. Using brlaser with Traditional BSD lpd (/etc/printcap)
If you are using a classic lpd spooler (such as on OpenBSD or FreeBSD) without CUPS, you cannot drop the rastertobrlaser binary directly into /etc/printcap as an input filter (:if=), because it is a CUPS raster filter rather than a standalone PostScript/PDF filter:
    • Input format: rastertobrlaser expects CUPS Raster format on standard input—not raw text, PostScript, or PDF.
    • Arguments & Environment: It expects 5 or 6 CUPS-specific command-line arguments (job-id user title copies options ) and relies on the PPD environment variable pointing to the printer's .ppd file to read resolution, duplexing, and paper settings. [1]



How to make it work in /etc/printcap:
You must write a small wrapper script for your :if= entry that converts incoming PostScript/PDF data into CUPS Raster before piping it to rastertobrlaser:
    • Convert input to CUPS Raster: Use Ghostscript (gs with -sDEVICE=cups) or pdftoraster (from cups-filters) to convert the incoming print job into CUPS Raster format.
    • Set the PPD environment variable: Export PPD=/path/to/your/brother.ppd inside the wrapper script.
    • Invoke rastertobrlaser: Pipe the rasterized stream into rastertobrlaser with dummy CUPS arguments (e.g., rastertobrlaser 1 user title 1 ""), which outputs the proprietary Brother laser data stream to standard output for lpd to send to the printer.


Upstream brlaser known supported printers does list the HL2305 as supported.

It would be easiest to use CUPS, install brlaser and select it as the printer driver in the configuration interface. It also might work with the IP everywhere filter
 
Back
Top