3

I'm trying to get a USB-connected Brother HL-2240 printer to work on Linux (Ubuntu Xenial with cups 2.1.3-4ubuntu0.3).

I turned debugging up to maximum and the cups error log very verbosely tells me everything succeeded. The page log simply lists the job as succeeded.

I generated the PCL file manually, ran /usr/lib/cups/backend/usb under strace, and it said it succeeded, with no apparent errors in the ioctls (lots of USBDEVFS_REAPURBNDELAY => EAGAIN, but that seems to be some sort of spinlock).

But nothing prints.

The printer physically works fine. I can print a test page by holding down the "go" button on the printer.

I've tried this with and without usblp. I don't have android-udev (one source thought that might be relevant). I tried re-installing cups.

It worked ages ago. I think I might have been on Precise Pangolin at the time. Yes, that's a long time to go without printing, and there may have been other relevant things in that time too.

I don't know for sure that the PCL documents I'm generating are correct. Is there a way to test those? Or a source of known-good documents for this printer?

But mostly, does anyone have any ideas how to fix this?

(I was going to post both the error_log and strace output here, but they're way too long. I've looked them over pretty thoroughly, but if there are strange things to look for, please suggest them.)

Edit to add:

I'm pretty sure it's finding the right printer because of lines in the log like:

D [28/Nov/2017:00:06:11 -0500] [Job 19] envp[23]="DEVICE_URI=usb://Brother/HL-2240%20series?serial=B3N746940"

That's the same serial number as in dmesg.

Also, when I invoke /usb directly:

export DEVICE_URI=usb://Brother/HL-2240%20series?serial=B3N746940
/usr/lib/cups/backend/usb 25 dspeyer hello 1 "" < /etc/hosts

I get

DEBUG: Loading USB quirks from "/usr/share/cups/usb".
DEBUG: Loaded 131 quirks.
DEBUG: Printing on printer with URI: usb://Brother/HL-2240%20series?serial=B3N746940
DEBUG: libusb_get_device_list=13
STATE: +connecting-to-device
STATE: -connecting-to-device
DEBUG2: Printer found with device ID: MFG:Brother;CMD:PJL,HBP;MDL:HL-2240 series;CLS:PRINTER;CID:Brother Laser Type1; Device URI: usb://Brother/HL-2240%20series?serial=B3N746940
DEBUG: Device protocol: 2
INFO: Sending data to printer.
DEBUG: Read 195 bytes of print data...
DEBUG: Wrote 195 bytes of print data...
DEBUG: Sent 195 bytes...
DEBUG: Waiting for read thread to exit...

(And similar things if I use a PCL file instead of a text file, but longer.)

If I use any other DEVICE_URI, I get error messages.

And a strace on the usb command contains:

ioctl(10, USBDEVFS_GET_CAPABILITIES, 0xe4c198) = 0
write(2, "STATE: +connecting-to-device\n", 29STATE: +connecting-to-device
) = 29
ioctl(10, USBDEVFS_GETDRIVER, 0xbf941308) = -1 ENODATA (No data available)
timerfd_settime(9, TFD_TIMER_ABSTIME, {it_interval={0, 0}, it_value={3607344, 967184000}}, NULL) = 0
ioctl(10, USBDEVFS_SUBMITURB, 0xe65ea0) = 0

Which indicates pretty clearly data is going over USB.

  • Have you tried lpr /etc/hosts or something simple? – EightBitTony Nov 28 '17 at 7:48
  • @EightBitTony I just did. Same deal. All OK in logs, silence from the printer. Looks like text documents get printed via texttopdf and then the usual chain, so this isn't very interesting. – dspeyer Nov 28 '17 at 7:56
  • Well it answers your query about whether the PCL documents are correct by removing that element of your process. Do you have another computer into which you can connect the printer to rule out hardware? – EightBitTony Nov 28 '17 at 7:58
  • @EightBitTony The text file got turned into a PCL file. I just tried invoking /usr/lib/cups/backend/usb directly on /etc/hosts, which returned success and did nothing, but I don't know if my printer accepts raw ASCII in the first place. – dspeyer Nov 28 '17 at 9:33
  • 1
    It could be that - due to updates - the Brother driver stopped working. I have witnessed such problems. One problem was Brother not carrying its drivers along updates in the OS and thus bitrotting. A symptom could be what you describe above: when you send something to the driver, it just swallows the data/document and says "yup, everything fine". Could you google around for the name of your Brother driver/the Brother model/your OS and see whether maybe someone else had problems with them? – Tomáš Pospíšek Nov 28 '17 at 22:15
3

I had this issue with a Brother HL-L2320D. I was doing a few things incorrectly. This post helped:

https://lists.debian.org/debian-user/2013/09/msg00529.html

  1. I was being too clever and trying to install the printer directly through the CUPS web interface, using the .ppd file and the CUPS filter. The CUPS filter actually invokes the LPD filter, so both are necessary. I ended up just installing the Debian packages Brother provided (hll2320dlpr-3.2.0-1.i386.deb and hll2320dcupswrapper-3.2.0-1.i386.deb).
  2. I needed support for 32-bit binaries. The suggestion here of the Ubuntu package gcc-multilib worked for me.

As for what causes the silent failure mode, I think it's various pieces of the filter pipeline failing without correctly reporting the failure back to CUPS; the printer gets sent either an empty file or an invalid one, and CUPS sees a success. The top-level filters are Perl scripts that call other scripts and binaries with the system function or backticks, without checking the exit codes.

  • +1. Many thanks to you. I wasted hell lot of time only to end up here and realize that both DEB packages are necessary for that printer to work. – Firelord Jan 6 '18 at 21:13
  • Number 2 did the trick for me, many thanks! If someone is running into this on Arch: Follow the instructions from the Wiki how to enable the multilib repository and install the multilib-devel group. – HenningCash Jul 29 '18 at 20:24
0

Expanding on Shivaram Lingamneni's answer...

Installing the drivers from the Brother website worked. As near as I can trace from the logs, if you send data down the wire to a Brother printer in anything other than perfect PCL, the printer will just do nothing. Very irritating.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.