# Printer/scanner and Linux drivers



## marcinkk (Nov 22, 2016)

Hi,

I have Brother DCP-1512E multifunction device. I'm not familiar with LPD, CUPS or sane but using Brother instructions I've configured the printer under Linux (Lubuntu) and it is now shared over the network. Both network printing and scanning work properly.

But... The Linux is run as a guest in VirtualBox machine on FreeBSD host using USB pass-through. As I said I'm not familiar with mentioned systems, but I found that I have the DCP-1512E.ppd file for CUPS and the libsane-brother4.so.1.0.7 library for sane installed in the linux system. My question is: Can I use those files in FreeBSD and avoid virtualization?

Regards,
Marcin


----------



## SirDice (Nov 22, 2016)

It's been a while but I think you can use the PPD file, the library however cannot be used, it's specific for Linux. That said, looking at the file it looks like it comes from SANE, I'm not sure if it's from graphics/sane-frontends or graphics/sane-backends.


----------



## shepper (Nov 22, 2016)

If you look in the ppd file on your Ubuntu system you should see a line regarding a filter or wrapper.  It is usually near the top of the file.  The cheaper brother printers use a "binary blob" that is compiled by brother on a linux system and distributed as an rpm or deb package.  If you have a binary blob with this printer (likely) then the print job will die at the blob.

The ideal thing would be to get the source code for the blob and compile it on FreeBSD.  I believe Brother has never released the source code for the blob and emails requesting the source go unanswered.

Some posts in this forum have successfully used the blob under linux emulation.  If you have questions post the initial portion of your ppd.  You may be able to install linux emulation and copy the "binary blob" over.


----------



## Oko (Nov 22, 2016)

marcinkk said:


> Hi,
> 
> I have Brother DCP-1512E multifunction device. I'm not familiar with LPD, CUPS or sane but using Brother instructions I've configured the printer under Linux (Lubuntu) and it is now shared over the network.


Linux driver has hidden binary blob. That is paperweight on BSD.


----------



## scottro (Nov 22, 2016)

Sometimes it turns out that a particular scanner can work using another scanner's driver that's included by Sane backends, e.g. it will turn out that unsupported scannerX can use supported scannerY drivers.  (However, a quick google didn't indicate that to be the case with this model, but I didn't look very hard.)


This ArchLinux post gives some steps for getting a brother printer working with foomatic, but don't know about the scanning.
https://bbs.archlinux.org/viewtopic.php?id=109570
Depending upon how much time you want to spend on it, you could probably quickly install a minimal Debian, Fedora, or similar VM that either uses .deb or rpm format,  and use  that.   (Or Arch, of course, but then you have to extract the files as mentioned in the thread.)


----------



## marcinkk (Nov 23, 2016)

scottro said:


> Depending upon how much time you want to spend on it (...)



If I'm sure that the operation will finish successfully I can spend some time on it. But after reading above answers I've analyzed ppd file and I found that some linux binaries are used finally. So it looks that natively it is impossible to get the printer working. Maybe the Linux emulation is the solution. It seems possible. Brother shares linux rpm packages. So I need linux-sane, linux-cups ... I must learn a little 



scottro said:


> (...) you could probably quickly install a minimal Debian, Fedora, or similar VM that either uses .deb or rpm format,  and use  that.



Now I'm using such solution as I mentioned in the first post. And it works fine. But usb pass-through stopped working with the newest VirtualBox, so I've started thinking about other possibility.


----------



## Sevendogs (Dec 5, 2016)

I was faced with this same scenario so ended up buying a postscript/pcl friendly printer. I still use.cups, mainly for ease of use but I can now print flawlessly. I ended buying a sane-backends friendly scanner as well so I could use xsane for scanning.


----------



## marcinkk (Jun 12, 2019)

Hello again 

I know that the thread is very old, but I've decided to upgrade my FreeBSD from 10.4 to 12.0 and I was forced to return to the problem described in the first post. It was was partially solved, but one by one:

1) The VirtualBox: Currently the 5.2 version is available in the ports/packages. It works fine, but only supports USB 1.0/1.1 devices - OHCI works, EHCI and XHCI does not work due to lack of VB Extension Pack under FreeBSD  I have the old port with VB 5.0 version, but it does not compile successfully  So my old solution with linux virtual machine is now useless 

2) The printer: I've enabled Linux® Binary Compatibility following the Handbook: https://www.freebsd.org/doc/handbook/linuxemu.html (I've decided to use c7 base, if it is important). Then I've downloaded appropriate drivers for my printer from Brother site: https://support.brother.com/g/s/id/linux/en/download_prn.html in rpm packages. The packages was unpacked in accordance with the internal structure. Then the POSTIN script has been extracted, modified to conform to the file structure of the FreeBSD system and run to install the CUPS and LPD driver. I've run successfully two Brother devices: HL-5250DN and DCP-1512E. Generally it was required to install CUPS (as described in the Handbook), modify some scripts (mainly paths, but I've also changed /bin/sh to /usr/local/bin/bash) and install some additional packages (a2ps and ghostscript, probably something more...). As I remember the CUPS driver was run very fast without problems, more modifications were required to activate LPD. Generally: working fine without problems.

3) The scanner: No succes. I gave up  Native sane does not recognize brother scanner after installing brother's libsane library. I've "installed" sane backed and frontend from CentOS 7 repository in the /compat/linux buth `/compat/linux/bin/scanimage -L` generates segmentation fault. And the `/compat/linux/bin/sane-find-scanner` does not recognize any USB device. Probably linux_libusb does not work properly. Under 10.4 I've run successfully both commands, but the scanner has not been seen  The `sane-find-scanner` listed the proper devid in the list, but `scanimage -L` does not recognized the scanner. Under 12.0 does not work anything.

Regards,
Marcin

PS. If the printer is not required locally under FreeBSD I think that the easiest solution is installation od p910nd package and connect to the printer in raw mode using JetDirect protocol. I'm going to try, but I haven't tested this solution yet.


----------



## shepper (Jun 12, 2019)

A couple of points.

The HL-5250DN has Brothers version of PostScript: BR-Script3.  You can send print jobs directly to it.  If you search this forum, Thread 63298 provided a setup.

A project has started providing OpenSource drivers for Brother gdi printers:
GitHub brlaser

An OpenBSD port of brlaser has been made and there is no reason a FreeBSD port cannot be made
OpenPorts brlaser

The problem with all-in-ones is that the usb port is scanned, on boot, for a ProductID.  Based on the ProductID it is assigned a driver if one is available.  HP writes a combination printer/scanner driver that is provided in the print/hplip package.  HP does not support non-HP products and for those you have to specify either a printer driver or a scanner driver or write a script to change them on the fly.

If I were in your shoes, I would keep the HL-5250DN and try to trade/barter the DCP-1512E for a flatbed scanner.


----------



## Sevendogsbsd (Jun 12, 2019)

That was my experience with brother all-in-ones: too many problems. I ended up giving up and buying a separate printer and flatbed scanner. Take up more room but now I can print and scan in FreeBSD...my wife and I repurposed our brother all-in-one as a fax machine and copier since it has those functions.


----------



## marcinkk (Jun 16, 2019)

shepper said:


> The HL-5250DN has Brothers version of PostScript: BR-Script3. (...)



HL-5250DN is my printer at work, I've just used it to test "brother linux drivers install procedure".

So going back to my DCP-1512E @home:

LPD:
I have in /etc/printcap:


```
lp|DCP1510:\
        :mx=0:\
        :sd=/var/spool/lpd/DCP1510:\
        :sh:\
        :lp=/dev/ulpt0:\
        :if=/opt/brother/Printers/DCP1510/lpd/filter_DCP1510:
rp|RAW:\
        :mx=0:\
        :sd=/var/spool/lpd/RAW:\
        :sh:\
        :lp=/dev/ulpt0:
```

The first one uses a little modified filter files from brother linux package (attached to this post) and works fine as a local "command line printer" for text files, pdf files and ps files. The second one is used for sharing with Windows, where the printer port is configured as follows (screen from polish version of windows, but I hope it looks similar in other languages):






To get it working it is required to fill properly /etc/hosts.lpd and add line `lpd_flags="-W"` to /etc/rc.conf.

CUPS:
brother linux drivers: works fine without problems, for local and remote printing;
brlaser driver: hmmm... compiles and installs fine, but "Print Test Page" in the CUPS does not work; the sharing of printer works properly - I think the driver is not used then, the CUPS just shares the port with remote machine and the data are sent to printer in raw format; so - works partially.



P910ND: does not work. I don't know why. Maybe permissions problem?
I hope the above information will be useful to somebedy, who will try to use and share brother printer with FreeBSD. Generally the propertiary brother linux drivers works fine in linux emulation environment, but some scripts requires modification.

----

And in the end about brotehr scanner. Still trying to run "linux sane" but the result is:


```
% /compat/linux/bin/scanimage -L
Segmentation fault (core dumped)
```

and `dmesg` reports:


```
linux: pid 69115 (scanimage): syscall name_to_handle_at not implemented
pid 69115 (scanimage), uid 0: exited on signal 11 (core dumped)
```

I don't know what it means.


----------



## shepper (Jun 16, 2019)

My comment was centered on using the DCP-1512E without linux emulation.  OpenSuse has an rpm with 1510.ppd:
See file list at bottom of link
OpenSuse rpm.pbone.net
It is possible to extract the 1510.ppd file in the rpm and then edit it.  There is a line that calls the rastertobrlaser and change this to the FreeBSD install location of rastertobrlaser.  If you're inclined (doesn't impact functionality), you can use find/replace for 1510 -> 1512E and rename to 1512E.ppd.  Then place the edited ppd in /usr/local/share/cups/model/ .  Rerun the cups configuration and the 1510.ppd/1512E.ppd should show up.

I can't help with the scanner and a quick web search for Brother scanner freebsd only came up with this thread.


----------



## marcinkk (Jun 17, 2019)

brlaser driver works ... with 600DPI setting, previously I've set 1200HQ - it does not work

edit:
it works now, the issue is described here: https://github.com/pdewacht/brlaser/issues/40
changed, recompiled, reinstalled and works fine in 1200HQ too


----------

