Solved Lexmark E350d on FreeBSD 10.1-RELEASE

Hi all,

I've just got a Lexmark E350d USB printer, and I'm wondering what my options are when it comes to setting up the printer on FreeBSD. I've had it working flawlessly on Windows, and Linux (with CUPS + PPD), so I know it works and I'd like to stick with it.

Generally, I need to print lots of different formats (documents, spreadsheets, images, webpages, PDFs, etc), often very quickly, and preferably directly from various programs (libreoffice, firefox, xpdf, etc).

I'm not interested in a political discussion of CUPS vs LPD, I just need to know: Can I print all of the above with LPD, directly from my applications (Firefox for example), or will I need CUPS for that?
 
The OpenPrinting site you linked says the printer can use the following printer drivers:
1) Postscript-Lexmark
2) Postscript
3) lj5grey
4) pxlmono

Postscript output is generated by most printing applications and my guess is that the Postscript-Lexmark driver adds some additional functionality like duplex, eco-mode etc.
So to answer your question, LPD will print directly from www/firefox and will be easy to set up. It will not provide eco-mode and will likely require some time/effort on your part to set up duplex printing and landscape printing via additional print queues. There are several on-line references for LPD printing including Chapter 10 in the handbook. One of the forum moderators also has a site on setting up LPD Printing and helped me in setting up LPD for a network printer on port 9100.

If you do not care about learning LPD printing, print/cups is available in FreeBSD. You can select the Lexmark PPD in the CUPS Browser Interface if you previously downloaded the PPD.
 
Last edited:
Thanks for clearing that up: I missed the part about applications such as www/firefox generating Postscript output (obvious when I think about it). I'd been focused on the command line stuff.

Sounds good! I like my print spoolers like my women; easy and simple. I suppose I can live without duplex printing for a while, and luckily I can control other important setting like "Paper Size", "Toner Darkness", "Resolution", "EcoMode" directly from the LCD panel on the printer, therefore, I've decided to give LPD a go.

So far I have used the handbook to:
# mkdir -p /var/spool/lpd/lp
# chown daemon:daemon /var/spool/lpd/lp
# chmod 770 /var/spool/lpd/lp
# echo 'lpd_enable=”YES”' >> /etc/rc.conf

# dmesg | tail
Code:
ugen3.4: <Lexmark International> at usbus3
ulpt0: <Lexmark International Lexmark E350d, class 0/0, rev 2.00/0.00, addr 4> on usbus3
ulpt0: using bi-directional mode
I've created my /etc/printcap:
Code:
lp|e350d|lexmark_e350d:\
  :lp=/dev/ulpt0:\
  :sh:\
  :mx#0:\
  :sd=/var/spool/lpd/lp:\
  :lf=/var/log/lpd-errs:
First test:
# cat README.txt > /dev/ulpt0 results in:
Code:
stdout: Bad file descriptor
And # dmesg | tail
Code:
ugen7.2: <Lexmark International> at usbus7 (disconnected)
ulpt0: at uhub5, port 2, addr 2 (disconnected)
And my printer has on its LCD screen: "900 Service - Watchdog Error"

Test 2 produces the same result - but with no console error message:
# [B]printf "1. This printer can print.\n2. This is the second line.\n" | lpr[/B]

As does test 3:
# lpr README.txt

According to Lexmark the "Watchdog Error" is:
A Watchdog Error is an error message that can appear if the printer is not receiving enough resources from its internal processor. In examples seen so far, the root cause of this message has been attributed more to software and/or network application functions than to internal printer functions.

After following the recommended procedures, I tried again with identical results.

Scared that my printer was simply dying on me, I connected it to a Linux box (with CUPS) and did the exact same tests, plus some PDFs and images, and everything worked as expected. No error messages. Same with Windows so I'm sure it is not a hardware problem.

Back to FreeBSD, the following produced no errors # chkprintcap

I thought about moving on, and giving some magic filters a try (print/magicfilter, print/apsfilter or print/foomatic-rip), but I suppose it won't help at this stage.

I seem to have hit a dead end - at least I don't know what else to try. Has anyone else had this kind of problem?
 
ugen7.2: <Lexmark International> at usbus7 (disconnected) ulpt0: at uhub5, port 2, addr 2 (disconnected)

It seems that sending the print job triggers the printer to disconnect the usb port. I looked at the Lexmark e350d specs to see if it included networking and it is an add-on.

The other thing on the spec page is that Postscript is not listed as a supported printer language.
Printer Languages (Standard)
PCL 5e Emulation
PCL 6 Emulation
Personal Printer Data Stream (PPDS)
PostScript 3 Emulation

Edit: PostScript 3 Emulation will work as PostScript and needs no filter. The emulation is written by Lexmark who are then not obligated to pay licensing fees to Adobe. The Lexmark Printer in this instance also supports PCL5e and PCL6.

This suggests that you will need a filter, Printers that are truely Postscript capable do not need a filter. I searched the forums and may have found some guidance on both problems in this
Thread 20559

The main points from the thread
1. Try
Code:
/dev/unlpt0
in your printcap. From the FreeBSD handbook on printer connections:
USB

USB printers can be connected to any available USB port on the computer.

When FreeBSD detects a USB printer, two device entries are created: /dev/ulpt0 and /dev/unlpt0. Data sent to either device will be relayed to the printer. After each print job, ulpt0 resets the USB port. Resetting the port can cause problems with some printers, so the unlpt0 device is used instead. unlpt0 does not reset the USB port at all.
2. There are also some simple example filters in the thread.
 
Last edited:
Thank you for your patience.

I realise that the Lexmark E350d does not support Postscript or ASCII - I'd simply expected the test prints above to produce nonsense, but not to crash my printer.

I can confirm that changing my /etc/printcap to use /dev/unlpt0 (the non-resetting device) does indeed stop the crashes when using the print test commands above! Excellent! I thought there would be other problems with my setup, and was waiting to try this later. :/

I then wanted a simple filter, so I installed print/ghostscript9, found my recommended ghostscript driver and created the file /usr/local/libexec/ps2pl with the following contents:
Code:
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=lj5gray -sOutputFile=- -

Made it executable:
# chmod +x /usr/local/libexec/ps2pcl

I am happy to say this enables me to print from www/firefox and other Postscript-generating applications.

Then I moved on to "smart filters":

I've chosen to install print/magicfilter (rather than the huge print/apsfilter which is twice the size of print/cups), but was unable to find a filter corresponding to my printer in /usr/local/libexec/magicfilter.

I didn't know which of the filters I should use, so I wrote one based on what was already there - /usr/local/libexec/magicfilter/lexmark_e350d and put the following in it:
Code:
#! /usr/local/bin/magicfilter
define(Vendor, `Lexmark')dnl
define(Printer, `E350d')dnl
define(DPI,`300')dnl
define(COLOR,`false')dnl
define(PCL,`true')dnl
define(DEVICE,`lexmark_e350d')dnl

I then added the filter to my /etc/printcap:
Code:
lp|e350d|lexmark_e350d:\
  :lp=/dev/unlpt0:\
  :sh:\
  :mx#0:\
  :sd=/var/spool/lpd/lp:\
  # :if=/usr/local/libexec/ps2pcl:\
  :if=/usr/local/libexec/magicfilter/lexmark_e350d:\
  :lf=/var/log/lpd-errs:

I don't know if this is the right approach, but with it I can print from Firefox, LibreOffice, xpdf, etc. and I can print PDFs with:
lpr somefile.pdf.

I will have a go at duplex printing, eco-mode, toner darkness, etc. and see how it goes. Thank you again for the help.
 
I think the main attraction for LPD printing is that it is relatively straight forward and generates good error codes. CUPS is easy but when it fails it is difficult for users to fix.
The most straight forward filter that meets your needs would be the best to use. I used a simple gs filter until I got the hankering to print #10 envelopes which required both a custom paper size and landscape output.
IMHO the most flexible filtering uses foomatic-rip. At the bottom of this Thread 48433 is a guide to use foomatic-rip with a *ppd. My printcap showing a queue for landscaped #10 envelopes is here. The advantage is that you can use the -o flag to pass pages sizes/orientation, print resolution options as described in the *ppd.
 
Last edited:
That sounds good. I'm interested in using a filter which enables me to use all the options present in my printer's PPD file, so I've installed print/foomatic-filters.

And based on this thread, I've written a filter which i've called /usr/local/libexec/foomatic.filter.default. Here it is:
Code:
#!/bin/sh

/usr/local/bin/foomatic-rip --ppd /etc/foomatic/direct/Lexmark-E350d-Postscript-Lexmark.ppd

I'm still not 100% what is going on here though. Does this mean I will be able to write my own filters that can use the full printer options, such as duplex, toner darkness, page size, paper type, etc, like this:
Code:
#!/bin/sh
/usr/local/bin/foomatic-rip --ppd \
/usr/local/etc/foomatic/direct/Lexmark-E350d-Postscript-Lexmark.ppd \
-o pages=two-sided-long-edge \
-o TonerDarkness=6

And does this mean that I will be able to use such options from the command line, I.E:
lpr -o TonerDarkess=10 -o sides=two-sided-long-edge file.ext
 
My understanding is that foomatic-rip broke and the resurrected foomatic-rip needs to first run the print job through a2ps or enscript.
I followed the guide in OpenBSD, the web version is here. I invoke the different outputs by calling a different print queue:
$ lpr calls the default lp printcap entry while $ lpr -P env10 uses the env10 printcap entry for #10 envelopes.

I do not think there is a limit on how many queues you can have. I set mine to 600dpi for daily printing, greyscale to speed up printing. I'm thinking that I will set up a third, letter queue for 300dpi printing for large jobs that could max out the printers memory.
 
Last edited:
I'll add a little bit more on the foomatic-rip filter. I initially set this up following the OpenBSD guide and it also worked in Debian Jessie (lpr is a Debian print option). I had difficulty with the foomatic-rip version that came with the print/foomatic-filters and posted here to see if I could set envelope sizes with just the gs filter. The man pages were sparse and I did not get any replies to my post.
The gs filter is simple and easy but the main problem for me is that I could not find any support for custom paper sizes or #10 business envelopes. I recall from my prior efforts that the gs filter does support portrait/landscape, legal/letter/a4, different resolutions and trays. If you do not need custom paper/#10 envelopes the gs filter may be all you need. You can review the gs/ghostscript documentation to double check.
 
Using the above links and guides, I have altered my filter script (/usr/local/libexec/foomatic.filter.default). Now it looks like this:
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/Lexmark-E350d-Postscript-Lexmark.ppd \
-o PageSize=A4 \
-o Resolution=300x300dpi \
-o OutputType=Grayscale \
-o Duplex=DuplexNoTumble \
-o TonerDarkness=1
I am still not sure as to whether I can use this method to enable printer specific settings (such as "Toner Darkness"), and if I can, how the options should be written. I'm trying combinatins of the following (taken from various man pages, config files and websites):
Code:
-o duplex
-o sides=two-sided-long-edge
-o Duplex=DuplexNoTumble
I'd experiment with paper sizes if I had any other than A4 - but really, I'm only interested in duplex and saving toner.

I have taken these settings from one of the recommended PPD files generated for use with print/foomatic-filters

The above configuration does not in fact print in duplex mode for example, nor does it respect my toner darkness settings.

Neither does the following configuration (using the pxlmono driver PPD)
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/Lexmark-E350d-pxlmono.ppd \
-o PageSize=A4 -o Resolution=300x300dpi \
-o ColorModel=Grayscale \
-o Duplex=DuplexNoTumble \
-o TonerDarkness=1
However, I see on the pxlmono driver page that a number of printer options, including duplex, need a patch for ghostscript8. I do not know about print/ghostscript9. The other recommended driver, namely lj5gray, makes no mention of print quality, toner darkness or duplex mode, so I am not even going to bother.

I also see that a number of options must be passed to print/ghostscript9 via options such as "-r RESOLUTION". I'm not sure how to do that as part of the current setup yet, but I will play around with it a bit, and see if I can get any of my printers options to work.
 
There are two foomatic-rip's available print/hpijs and print/foomatic-filters. I tried the latter with a ppd I generated from the gutenprint data base without success. Oko had posted hpijs foomatic-rip as an example in the FreeBSD forum but it is not clear that he attempted this in FreeBSD. Oko prefers OpenBSD as a desktop. I have been meaning to try the hpijs foomatic-rip but have not gotten around to it. I did find the documentation for passing options to the gs driver here and here. One of my tasks for today was to see if I could set up envelope printing with gs in FreeBSD. Ideally, I would like a filter that works across FreeBSD/OpenBSD/Debian. foomatic-rip has been broken in the past and one or both versions may still be broken in FreeBSD.

The following 2 filters function correctly (paper tray, custom page size and page orientation) in OpenBSD and Debian Jessie
1) Default
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 --medium=Letter --borders=no -o - | \
  /usr/local/bin/foomatic-rip --ppd \
  /etc/foomatic/direct/HP-LaserJet-5L.ppd \
  -o PageSize=Letter -o Resolution=300x300dpi \
  -o OutputType=Grayscale
2) #10 Envelopes with custom env10 pagesize in a2ps.cfg, landscape, manual paper tray
Code:
#!/bin/sh

/usr/local/bin/a2ps -Brq --columns=1 --medium=env10 --borders=no  -o - | \
  /usr/local/bin/foomatic-rip --ppd \
  /etc/foomatic/direct/HP-LaserJet-5L.ppd \
  -o InputSlot=Manual -o PageSize=COM10 \
  -o Resolution=300x300dpi -o OutputType=Greyscale
Edit: To clear up a potential point of confusion
Code:
Resolution=300x300dpi
is a valid entry in my
HP-LaserJet-5L.ppd
Code:
*Resolution 300x300dpi/300 x 300 dpi: "%% FoomaticRIPOptionSetting: Resolution=300x300dpi
The syntax in the Lexmark ppd below was "PrinterResolution"
The moral of the story is to use the same syntax as ppd you are utilizing
 
Last edited:
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/Lexmark-E350d-pxlmono.ppd \
-o PageSize=A4 -o Resolution=300x300dpi \
-o ColorModel=Grayscale \
-o Duplex=DuplexNoTumble \
-o TonerDarkness=1

Looks mostly good to my eye.. The one question I have is the /usr/local/bin/foomatic-rip -P lp entry. My understanding is the -P flag is optional and is the printer name which in your case would be something on the order of "Lexmark". It should not be hanging up on a text entry but I would remove it while troubleshooting.
 
I'd experiment with paper sizes if I had any other than A4 - but really, I'm only interested in duplex and saving toner.

You should be able to modify your original gs filter for duplex, a4 and decreased toner use by decreasing print density.
Code:
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=lj5gray -sOutputFile=- -

The gs documentation here. Particularly pertinent are the Devices.htm and Use.htm links
Generic Ghostscript options that are particularly relevant for IJS are summarized below:

-rnumber
-rnumber1xnumber2
Sets the resolution, in dpi. If the resolution is not specified, Ghostscript queries the IJS server to determine the preferred resolution. When the resolution is specified, it overrides the value (if any) preferred by the IJS server.
-dDuplex
-dTumble
These flags enable duplex (two-sided) printing. Tumble controls the orientation. When Tumble is false, the pages are oriented suitably at the left or right. When Tumble is true, the pages are oriented suitably for binding at the top or bottom.
-sProcessColorModel={name}
Use this flag to select the process color model. Suitable values include DeviceGray, DeviceRGB, and DeviceCMYK.
I cannot fully test this but I did use the syntax from Use.htm to set an envelope size and documented in Thread 49883
Code:
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sPAPERSIZE=a4 -dDuplex -dTumble -sDEVICE=lj5gray -sOutputFile=- -
 
300 versus 600 DPI will probably not save an appreciable amount of toner. At 300 DPI, it only prints a quarter of the dots, but they are four times larger. The dots are round, so there might be a little less toner used at the corners of the grid. However, some printers vary the dot size to increase sharpness and might offset this automatically. In short, it's probably not worth the hassle.
 
On review I see an issue with your foomatic-rip filter and It sounds like your filter partially works. I was unable to get any output a couple of weeks ago with print/foomatic-filters.
Can I ask if you used foomatic-rip from print/hpijs or the version from print/foomatic-filters?

I set this up using the syntax in the ppd and I had sense that -o commands stopped at incorrect entries..

The following section is from Brother-DCP-8045D-pxlmono.ppd I generated at OpenPrinting
Code:
*OpenUI *PrintoutMode/Print Quality: PickOne
*FoomaticRIPOption PrintoutMode: enum Composite A
*OrderDependency: 10 AnySetup *PrintoutMode
*DefaultPrintoutMode: Normal
*PrintoutMode Draft/Draft: "%% FoomaticRIPOptionSetting: PrintoutMode=Draft"
*FoomaticRIPOptionSetting PrintoutMode=Draft: "PrinterResolution=600x6&&
00dpi ColorModel=Grayscale"
*End
*PrintoutMode Normal/Normal: "%% FoomaticRIPOptionSetting: PrintoutMode=Normal"
*FoomaticRIPOptionSetting PrintoutMode=Normal: "PrinterResolution=600x&&
600dpi ColorModel=Grayscale"
*End
*PrintoutMode High/High Quality: "%% FoomaticRIPOptionSetting: PrintoutMode=High"
*FoomaticRIPOptionSetting PrintoutMode=High: "PrinterResolution=1200x1&&
200dpi ColorModel=Grayscale"
*End
*CloseUI: *PrintoutMode

-o PrintoutMode=Draft should set both 600x600dpi and Greyscale. Per @wblock it will not save much toner but I suspect it will speed up processing.
I'm wondering if your filter entry in red below is not recognized. The lowest resolution I see in the ppd is 600dpi and the
syntax is "PrinterResolution" as opposed to "Resolution".

#!/bin/sh /usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/Lexmark-E350d-pxlmono.ppd \
-o PageSize=A4 -o Resolution=300x300dpi \
-o ColorModel=Grayscale \
-o Duplex=DuplexNoTumble \
-o TonerDarkness=1

Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/Lexmark-E350d-pxlmono.ppd \
-o PageSize=A4 -o PrintoutMode=Draft \
-o Duplex=DuplexNoTumble \

Edit: Clarify Draft as setting both Greyscale and lower resolution
 
Last edited:
I have installed print/foomatic-filters and I can finally confirm that I am able to print with it, even making use of "draft" and "duplex" options. I am also able to print in "draft" mode with duplex using print/ghostscript9. Thank you for your help.

Using print/foomatic-filter: You are right, I appear to have used the wrong syntax, although I think the values (300dpi) should be OK. My /usr/local/etc/foomatic/direct/lexmark-e350d-pxlmono.ppd contains the following:
Code:
PrintoutMode=Draft"
*FoomaticRIPOptionSetting PrintoutMode=Draft: "PrinterResolution=600x600dpi ColorModel=Grayscale"
and later:
Code:
PrinterResolution=@PrintoutMode"
*PrinterResolution 300x300dpi/300x300 DPI: "%% FoomaticRIPOptionSetting: PrinterResolution=300x300dpi"
I can confirm that the following worked for me (using the "Draft" option you mentioned):
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/lexmark-e350d-pxlmono.ppd \
-o PageSize=A4 -o PrintoutMode=Draft \
-o Duplex=DuplexNoTumble
As does the following (using 300dpi):
Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
/usr/local/bin/foomatic-rip -P lp \
--ppd /usr/local/etc/foomatic/direct/lexmark-e350d-pxlmono.ppd \
-o PageSize=A4 -o PrinterResolution=300x300dpi \
-o Duplex=DuplexNoTumble
Both work beautifully, duplex and all:)

I can also print using "draft" and "duplex" settings with the /usr/local/libexec/ps2pcl filter mentioned earlier (requires print/ghostscript9):
Code:
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sPAPERSIZE=a4 -dDuplex -dTumble -r300 -sDEVICE=pxlmono -sOutputFile=- -
So I am a very happy camper! Thank you for your help.
 
I am also happy to say I can print, using "draft" and "duplex" options using print/magicfilter. Here is the filter I have written:
Code:
#! /usr/local/bin/magicfilter
define(Vendor, `Lexmark')dnl
define(Printer, `E350d')dnl
define(DPI,`600')dnl
define(COLOR,`false')dnl
define(PCL,`true')dnl
define(DEVICE,`lexmark_e350d')dnl
define(PS_OPTIONS, `-dSAFER -dNOPAUSE -q -sPAPERSIZE=a4 -dDuplex -dTumble -sPrintQuality=Draft')dnl
So in summary, I can print using LPD, via three different filters, all using toner saving options and duplex mode. :)
 
I have installed print/foomatic-filters and I can finally confirm that I am able to print with it,

Good. I'm thinking about another go with foomatic-filters in FreeBSD. The ppd provides a large number of paper sizes and envelopes. I try to use binary packages and the foomatic-filters package pulls in print/enscript-a4. I'm in the U.S. using papersize=letter and I do not have a good handle on whether I need to build foomatic-filters using enscript-letter or just ignore it as I will be using print/a2ps rather than enscript. Per the man pages, papersize can be specified in either a2ps or enscript so I also do not see why there are separate enscript-a4 and enscript-letter binary packages. Enscript is a FreeBSD build dependency for foomatic filters. In OpenBSD, foomatic-rip is provided by either cups-filters or hpijs. OpenBSD's cups-filters does not have a build/runtime dependency for enscript or a2ps.

It is also interesting to look at what now is defined as draft. My old HP 5L is max'ed out at 600dpi. Draft is 300dpi and the ppd has both 75dpi and 150dpi options. I should get a newer printer but this is doing all that I need.
 
Last edited:
Back
Top