Cheap USB printers and FreeBSD
Dru Lavigne says in her book “The Best of FreeBSD Basics,” “Somewhere there must be a theory stating that the amount of configuration knowledge required is directly proportional to the need for said configured service. This is certainly often the case with printing.”
Well, for printing with a Samsung Laser Printer (ML-2510) under FreeBSD, she’s completely right. Not only was configuring the printer difficult, but it always felt like I was fighting against the natural order of things to make it work.
Linux / UNIX offer lots of ways to make printing happen. I wouldn’t call any of these ways elegant to a user –
it’s like having to learn how each component of your car functions before you can drive to the store.
Here’s the situation as best as I can describe it: Printing uses lots of little components.
Depending on what hardware you’ve got (i.e. what printer), those pieces parts will be different. As best as I can gather, here’s a diagram of what happens when I now print a document from the web browser:
[web doc]—->[postscript]—>[raster]—>[samsung language]
If I had one of those expensive printers that handles the postscript language directly (like an old-timey HP), I think those last two steps would be unneccessary.
FreeBSD by default uses something called LPD or Line Printer Daemon. I usually like to stick with what it comes with (becuase that’s usually pretty wise), but in this case I gave up on LPD.
For the two things I need to be doing — printing to the printer, and printing to PDF, the alternative (CUPS) is much more mature and capable.
On to the configuration. Here’s a step by step account of what I did to make it work:
1. I ditched the default LPD (line printer daemon). I did this by editing /etc/rc.conf and commenting out the line that looks like
lpd_enable="YES"
(put a # in front of it)
2. I installed splix (open source samsung drivers):
cd /usr/ports/splix
make install clean
(note that this will also install cups if not already installed)
3. I enabled cups (a modern printing system): edit the /etc/rc.conf file and add the following:
cupsd_enable="YES"
4. start cups; run the following:
/usr/local/etc/rc.d/cupsd start
5. go to cups from a web browser. Use your web browser of choice and navigate to http://localhost:631 You should see the CUPS web interface. If not, recheck stops 3 and 4 above.
Now, click on “add printer.” Give it a short name (without spaces). I used SAMMY.
Give it a location. I used “Here”
And give it a description- call it whatever you want.
Click on continue. Select USB Printer #1. Click on continue.
Now it’s time to find the printer driver.
You might have luck going to samsung under “make”, then clicking continue and finding the printer model. Or you might have to tell it where the .PPD file resides. I had to navigate to /usr/local/share/cups/model/ml-2510.ppd, or maybe /usr/local/share/ppd/SAMSUNG/ml-2510.ppd
Anyway, once you find it, click on “Add Printer” to make it happen. CUPS should tell you it was added.
There are a couple more things you need to do before it’ll work right: 1. Open up the /usr/local/etc/printers.conf file, and look for Device URI. Change the line that says
usb:/dev/ulpt0
to read
file:/dev/ulpt0
Save that file 2. Install the cups to raster port: cd /usr/ports/print/cups-pstoraster make install clean (or package_add cups-pstoraster) 3. Change the permissions on /dev/ulpt0: edit (or create if it doesn’t exist) /etc/devfs.rules add the following text to that file:
[system=10] add path 'ulpt*' mode 0660 group cups
4. Restart cupsd so all those changes can take effect:
/usr/local/etc/rc.d/cupsd restart
5. Test the printer to make sure it’ll print now: head to http://localhost:631 click on “printers” click on “print test page.” if it works, congratulations, that wasn’t easy. if you want to use lpd, I think you can still use foomatic-rip. Useful documentation / credits: ditdy had most of the info. The rest came from This post on the FreeBSD site.

January 19th, 2010 at 2:31 PM
Do you have any problem printing from a windows machine? I have an Samsung ML1610 and I can print once from windows machine then it refused to print, but with successful message. I have to reboot the printer to make it work again.