# Printing to Brother HL2270DW [Solved]

## justin_brody

Hello,

I'm hoping someone can help me debug a printing problem.  I have a Brother HL2270; I followed the installation instructions here:  https://forums.gentoo.org/viewtopic-t-861365-start-25.html.  This worked for me at first but then it didn't!

Currently, when I try to print a test page, what comes out is raw (unrendered) postscript.  So I'm guessing one of the filters isn't doing what it should!  Can anyone give me some pointers on how to test this.  Here are some lines from /var/log/cups/error_log:

```

...

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[17]="LANG=en_US.UTF-8"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[18]="PPD=/etc/cups/ppd/HL2270DW.ppd"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[19]="RIP_MAX_CACHE=8m"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[20]="CONTENT_TYPE=application/postscript"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[21]="DEVICE_URI=socket://192.168.10.200"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[22]="PRINTER=HL2270DW"

D [01/Apr/2011:17:01:38 -0400] [Job 604] envp[23]="FINAL_CONTENT_TYPE=printer/HL2270DW"

I [01/Apr/2011:17:01:38 -0400] [Job 604] Started filter /usr/libexec/cups/filter/pstops (PID 7320)

I [01/Apr/2011:17:01:38 -0400] [Job 604] Started filter /usr/libexec/cups/filter/brlpdwrapperHL2270DW (PID 7321)

I [01/Apr/2011:17:01:38 -0400] [Job 604] Started backend /usr/libexec/cups/backend/socket (PID 7322)

D [01/Apr/2011:17:01:38 -0400] Discarding unused job-state-changed event...

D [01/Apr/2011:17:01:38 -0400] cupsdProcessIPPRequest: 19 status_code=0 (successful-ok)

...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Connected to 192.168.10.200:9100 (IPv4)...

D [01/Apr/2011:17:01:38 -0400] [Job 604] backendRunLoop(print_fd=0, device_fd=5, use_bc=1, side_cb=0x8049010)

D [01/Apr/2011:17:01:38 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:01:38 -0400] Discarding unused job-progress event...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Page = 595x842; 18,12 to 577,830

D [01/Apr/2011:17:01:38 -0400] [Job 604] slow_collate=0, slow_duplex=0, slow_order=0

D [01/Apr/2011:17:01:38 -0400] [Job 604] Before copy_comments - %!PS-Adobe-3.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] %!PS-Adobe-3.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%BoundingBox: 0 0 612 792

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%Pages: 1

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%LanguageLevel: 1

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%DocumentData: Clean7Bit

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%DocumentSuppliedResources: procset testprint/1.3

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%Creator: Michael Sweet, Apple Inc.

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%CreationDate: D:20090113092400+0800

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%Title: Test Page

D [01/Apr/2011:17:01:38 -0400] [Job 604] %%EndComments

D [01/Apr/2011:17:01:38 -0400] [Job 604] Before copy_prolog - %%BeginProlog

D [01/Apr/2011:17:01:38 -0400] [Job 604] Before copy_setup - %%Page: 1 1

D [01/Apr/2011:17:01:38 -0400] [Job 604] Before page loop - %%Page: 1 1

D [01/Apr/2011:17:01:38 -0400] [Job 604] Copying page 1...

D [01/Apr/2011:17:01:38 -0400] [Job 604] pagew = 559.0, pagel = 818.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] bboxx = 0, bboxy = 0, bboxw = 595, bboxl = 842

D [01/Apr/2011:17:01:38 -0400] [Job 604] PageLeft = 18.0, PageRight = 577.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] PageTop = 830.0, PageBottom = 12.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] PageWidth = 595.0, PageLength = 842.0

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 1 pages...

D [01/Apr/2011:17:01:38 -0400] PID 7320 (/usr/libexec/cups/filter/pstops) exited with no errors.

D [01/Apr/2011:17:01:38 -0400] [Job 604] Read 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:01:38 -0400] Discarding unused job-progress event...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Read 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Read 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 4096 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Read 8192 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 8192 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Read 8192 bytes of print data...

D [01/Apr/2011:17:01:38 -0400] [Job 604] Wrote 8192 bytes of print data...

...<[i]LOTS more lines like this[/i]

D [01/Apr/2011:17:02:03 -0400] [Job 604] Read 2377 bytes of print data...

D [01/Apr/2011:17:02:03 -0400] [Job 604] Wrote 2377 bytes of print data...

D [01/Apr/2011:17:02:08 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:02:08 -0400] Discarding unused job-progress event...

D [01/Apr/2011:17:02:08 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:02:08 -0400] Discarding unused job-progress event...

D [01/Apr/2011:17:02:08 -0400] PID 7322 (/usr/libexec/cups/backend/socket) exited with no errors.

D [01/Apr/2011:17:02:08 -0400] [Job 604] File 0 is complete.

I [01/Apr/2011:17:02:08 -0400] [Job 604] Completed successfully.

D [01/Apr/2011:17:02:08 -0400] Discarding unused printer-state-changed event...

D [01/Apr/2011:17:02:08 -0400] Discarding unused job-completed event...

D [01/Apr/2011:17:02:09 -0400] [Job 604] Unloading...

```

Any pointers would be GREATLY appreciated!

Thanks!

[/quote]Last edited by justin_brody on Wed Jun 01, 2011 9:26 pm; edited 2 times in total

----------

## IRQsRFun

From what I was able to get from a very quick skim of the thread, there was only a reference of installing CUPS using rpm.  I usually avoid using other package managers with Gentoo since it conflicts with the Gentoo package manager portage (things might break on updates).  Perhaps you should look at:

http://www.gentoo.org/doc/en/printing-howto.xml

This uses emerge to install cups so that portage knows about it and will not make changes to other thing that will break cups.

----------

## Clad in Sky

What do you mean, it worked? Did the printer first work and now all of a sudden it doesn't?

A how to for the HL-2140 can be found here. 

http://en.gentoo-wiki.com/wiki/Brother_HL-2140

Should also work for your printer driver.

----------

## justin_brody

Hi,

Thanks for the thought!  I am actually getting cups out of portage; what comes through rpm is "cupswrapper" and the brother print driver, which unfortunately don't seem to exist in portage.

I've borrowed a big book on CUPS from my library; going to have a debugging party soon.  Woot woot!

----------

## IRQsRFun

I have a different model than you.  

My cups has been working for a long time though I only print a few times a year.  I do not remember using a cups wrapper.  I think I just imported the cups driver using the GUI when I created a printer.  

Anyway, you got yourself a book which is more than what I had when I got this working.

Best of luck.

----------

## justin_brody

Still can't get the beast working; I do have some extra information though.

I've managed to collect the output of the various filters that CUPS sends the file through.  It seems like the chain is:

   1.  Application converts whatever the file is to postscript.

   2.  PS file is sent through /usr/libexec/cups/filter/pstops.  This handles pagination and that kind of  thing.

   3.  Output of that is sent through /usr/libexec/cups/filter/brlpdwrapperHL2270DW.  This converts postscript to PCL.

   4.  PCL file is sent to /usr/libexec/cups/backend/socket

What I'm getting is postscript output, which made me think it wasn't being converted.  I think it IS actually being converted, but it's writing the postscript text in PCL, rather than "rendering" it.  I'm guessing the problem is then in whatever happens in step 3.  

I've tried reinstalling the stuff from Brother a few times, but that hasn't helped.  

A couple questions:

  a.  Can anyone tell me the right way to use the "rpm" command to force a reinstall?

  b.  Does anyone on the forum know enough about the Brother drivers to know if there's some switch it needs to be passed to tell it that what's coming in postscript which needs to be rendered rather than just plain text?

I think I'm probably gettting to the point where I need to take it up with the "Brother" people; hopefully their Linux support is official!

Thanks for all the responses so far, and any additional help anyone can provide!

----------

## justin_brody

O.k. - I've been tracing through the scripts and I think I've figured out the problem!    :Razz: 

The final filter uses the "file" command to figure out whether or not what's coming in is PostScript.

Here's the beginning of the file:

```

citta HL2270DW # head /tmp/br_input_ps.W5Uf7t 

%!PS-Adobe-3.0

%%LanguageLevel: 1

%%DocumentData: Clean7Bit

%%DocumentSuppliedResources: procset testprint/1.3

%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman

%%Creator: Michael Sweet, Apple Inc.

%%CreationDate: D:20090113092400+0800

%%Title: Test Page

%%For: (anonymous)

%RBINumCopies: 1

```

But:

```
citta HL2270DW # file /tmp/br_input_ps.W5Uf7t 

/tmp/br_input_ps.W5Uf7t: [b]data[/b]

```

So the "file" command isn't recognizing the file as postscript.

Anyone know what I need to do to change that?

----------

## Raptor85

I never used the RPM commands to install my Brother laser printer, it was a long time ago but it was pretty much 

1. Install CUPS

2. Install foomatic-filters

3. Install PPD file

Have you installed anything since then maybe? Since you did it outside the package manager there's a good chance portage could have overwritten anything installed and you could have version conflicts in scripts (potentially the filters?)

----------

## justin_brody

Hi Raptor85,

Thanks for the note!  I poked around, and it looks like you can install this with foomatic.  I'll definitely go that route if I can't get this to work. 

In the meantime, I've found some confirmation here:  https://bbs.archlinux.org/viewtopic.php?id=113962.  So I'm guessing it's exactly an upgrade of the file command that broke things.  I tried upgrading file to 5.07 but no go.   Unfortunately downgrading isn't an option in the current portage  :Sad: 

I'll try a bug report!

----------

## justin_brody

So I filed a bug-report for sys-apps/file.  It should be fixed in a future version.  For anyone else who has this problem (starts with file-5.05 I think), I added to the following lines to /usr/local/Brother/Printer/HL2270DW/lpd/filterHL2270DW:

```

#Hack until the "file" command gets fixed

if [ `head -1 $INPUT_TEMP1 | grep "%!PS"` ] ; then

    FILE_TYPE="PostScript"

fi

```

I put this right after the line that says:

```

FILE_TYPE=`file $INPUT_TEMP1 | sed -e 's/^.*:[ ]*//' -e 's/[ ].*//'`

```

This does the trick so far!

----------

## mrpdaemon

I've written e-builds for the drivers of this printer in case anyone is interested:

https://bugs.gentoo.org/show_bug.cgi?id=432166

----------

