cat FILE > /dev/lp0 finally works!
I thought I'd post this here because it took me so long to get it working and I might save someone else a big headache.
I bought a Samsung ML-1660 printer recently, a monochrome laser printer that was on sale for $69. I immediately tested it out with XP and it prints beautifully, but the paper feed is a bit wimpy and tends to slurp up multiple sheets on larger print jobs. No big deal, I don't intend to be printing out huge manuals and stuff anyway.
In linux, I have no idea why, but CUPS has never worked properly. It's so convoluted and nearly impossible to configure correctly. So after messing with that for quite a while, downloading fresh source, etc I finally gave up on it.
Samsung has a Unified Linux Driver on their site, so I downloaded it and checked it out. It is totally based upon the assumption that you have CUPS working. Too bad for me.
After MUCH messing around, this is what I discovered:
Whatever FILE you want to print, convert it to postscript. The is a multitude of converters (ImageMagick, pdftops, enscript, et al) that are pretty much standard on every linux distro.
The only files you need from the Samsung driver package are:
raster2samsungspl (a binary)
and
ML-1660.ppd (a text file)
Strangely enough raster2samsungspl _requires_ 6 command line arguments:
1. job_id
2. user
3. title
4. #copies
5. options
6. and last but not least, the FILE.ps
All of these arguments are completely ignored, but are also completely required, so you can go:
Code:
raster2samsungspl 1 1 1 1 1 FILE.ps
And it does nothing. No complaint. Nothing. Just fails silently.
So, even that is not enough to convert FILE.ps into the FILE.spl that the printer needs to do it's job.
After using a hexeditor on raster2samsungspl, I discovered an error string near the end of it:
Code:
PPD ERROR: Environment variable PPD undefined or empty?
AHA! You need to tell it where the FILE.ppd is too. Why doesn't say that? God only knows. If it expects you to have CUPS running, why doesn't it look in /etc/cups/? I dunno.
So now we have the command:
Code:
export PPD=/etc/cups/ml1660.ppd raster2samsungspl 1 1 1 1 1 FILE.ps
And we finally have many pages of gibberish dumped to the screen. We're getting close...
Modify that to go:
Code:
export PPD=/etc/cups/ml1660.ppd raster2samsungspl 1 1 1 1 1 FILE.ps > FILE.spl
And WOW! I now have a file that prints in full monochrome glory!
Code:
cat FILE.spl > /dev/lp0
And then I went and upgraded ghostscript from 7.07 to 8.01 for a reason I cannot remember, and the whole thing broke. Postscript files were now unusable so the printer driver coughed errors and failed.
In using gsview to look at the PSFILEs, it always complained about missing fonts and failed also.
Ghostscript needs a Fontmap in /usr/local/share/ghostscript/8.01/lib/
and, oh boy, it is not forgiving about that one. You also need to tell it where to find the thing too. It's not good enough just to export the GS_LIB and stuff like the manpage says, you have to tell the individual programs that use gs where to look.
So now our print command goes like this:
Code:
GS_FONTPATH=/usr/local/share/ghostscript/8.01/Resource/Font/ \
GS_LIB=/usr/local/share/ghostscript/8.01/ \
export PPD=/etc/cups/ml1660.ppd \
raster2samsungspl 1 1 1 1 1 FILE.ps \
> FILE.spl
And you have FILE.spl that you can happily type:
Code:
cat FILE.spl > /dev/lp0
as many times as you want for as many copies as you want and it _actually_ prints.
Woo hoo! (Do a little jig and kiss the wife)
I hope someone else can avail themselves of this information.