I recently brought a new laser printer with double-side feature.
I was really happy, because friends just tell me “It work out-of-the-box with FreeBSD”.
I fact, it don’t. I had to make some hacks to make it working.
The printer
The Printer is a MB2236 (MB2200 series), double-sided and scanner.
It’s connected to my local network, with a fixed IPv4 address.
The drivers
Which Driver?
As excepted there is no FreeBSD drivers, only windows and Linux
.deb
and .rpm
based distribution and a curious file Drivers files for CUPS-base systems
. Let’s take it from this
page.
I downloaded a Lexmark-AEY-PPD-Files.tar.Z
.
Uncompress the file
Using the old school uncompress
Unix utility, I obtain a .tar
file which
it’s easy to untar. The result is a folder named ppd_files
.
Inside ppd_files
folder
As you can guess, there is a lot of ppd
files and a shell script
install_ppd.sh
. This script won’t run on FreeBSD without modifications. I need
to change some path to be conform to the FreeBSD hierarchy.
Modifying the install_ppd.sh
script
In fact it was easy, just add /local
on most path. In order to change
/usr/share/footmatic
into /usr/local/share/footmatic
. And so on.
Run the script.
Once modified, the script run well \o/. That’s a first victory.
Modify some path
The file /usr/local/libexec/cups/filter/rerouteprintoption
is a perl script
with a Linux way
shebang. Once again changing /usr/bin/perl
by
/usr/local/bin/perl
solve a big trouble.
The PPD file
The script make a big part, but not all.
In /usr/local/share/ppd
create a Lexmark
folder and copy, from
ppd_files/GlobalPPD_1.4/Lexmark_MB2200_Series.ppd
into it.
Launch cupsd
Before launching cupsd
we need to install the linux-c7
emulation packages:
sudo pkg install linux-c7
And make something really bad on FreeBSD, make a change in the system filesystem
by creating a symlink into /usr/lib
:
sudo ln -s /usr/local/libexec/cups /usr/lib
Make cups
launch at boot time
sysrc cupsd_enable="YES"
Start cupsd
service cupsd start
Create the printer
With your browser go to http://localhost:631
in order to create your printer.
Create and admin the printer is not the goal of this blog post. You can find help directly on the cups page.
Enjoy
This method does not use the system lpr
print-system. I really try to find how
to make it work but I can’t. All my files seems ok (/etc/printcap
), I can ping
the printer and send via netcat
a file on it, but the lpr
system does not
allow me to print.
The “old school " LPD
daemon
There is another (brick in the wall) way to use this printer. The “good old
school” lpd
daemon.
Enable and launch the daemon
The most easy part, enabling and start the daemon:
sudo sysrc lpd_enable="YES"
sudo service ldp start
Declare the printer in the /etc/printcap
Not all the option of this file could be explain on the post. Remember to read the man page for more option or more detailed explanation.
lp:\
:lp=9100@192.168.1.207:\
:sh=false:\
:mx#0:\
:sd=/var/spool/output/lpd:\
:if=/usr/local/libexec/psif:\
:lf=/var/log/lpd-errs:
The default printer is call lp
:
:lp=9100@ipaddres:
is the ip address of my printer and the listen port;:sh=false:\
no banner;:mx#0:
max file size;:sd=/var/spool/output/lpd:
spool directory;if=/usr/local/libexec/psif:
text filter;lf=/var/log/lpd-errs:
error login file path and name
Be really careful of difference between if
and lf
You can check the syntax of your file with chkprintcap
Create the spool dir
The spool directory (sd
line of printcap
file) must be exist.
sudo mkdir /var/spool/output/ldp
and must belong to :daemon:daemon
:
sudo chown -R daemon:daemon /var/spool/output/ldp
Then your can restart the ldp
daemon.
The filter script
The page said
exactly the same things as this post and give you the source of the psif
filter.
Paper size default
You surely need to install the ASCII to Postscript filter depending of your default paper size:
pkg search enscript
enscript-a4-1.6.6_3 ASCII to PostScript filter
enscript-letter-1.6.6_3 ASCII to PostScript filter
enscript-letterdj-1.6.6_3 ASCII to PostScript filter
nenscript-1.13.3 Clone of the proprietary enscript program from Adobe Systems
p5-Tk-Enscript-1.10_4 Text-to-PostScript converter using Tk::Canvas
zh-enscript-a4-1.6.6_3 ASCII to PostScript filter
Next
Next? You should print from the command line:
lpr /COPYRIGHT
Or from differents softwares, choosing Print to LPR
.
To conclude
It take me a long long time to find a way to make this printer print… Hope this can be help you. I must admit that I prefer use the “old school way” :-)
Acknowledgements
Thanks to the FreeBSD-Questions mailing list members, who help me to find a solution.