Logo

Printers: Samsung CLP-500 print server 

Samsung CLP-500 print server

Background

Samsung CLP-500 with print server Years ago I had a colour inkjet printer that didn't have a great deal of use as, being a cheapskate, I was put off by the high cost per page of colour printing. As a result the heads tended to dry up and any time I went to print anything in colour I ended up using up a lot of the ink trying to get it flowing again. When I retired I got a monochrome HP Laserjet printer (an old 2200DN) which has served my needs admirably for the last seven years. It's networked and fitted with a duplex unit and, like most of my stuff, came from eBay for not a lot of money.

Recently I was wondering about adding colour laser printer for the odd occasion when colour would be nice and so started watching eBay. One appeared locally for ~£10 ($15) which was apparently working, in good condition, included a duplex unit and still had reasonable levels of toner in it. There was no network interface but beggars can't be choosers. So I invested the money and the time and petrol (gas) to go and get it.

Too good to be true? Well it was a Samsung CLP-500 dating from 2004 (11 years old) with a USB interface. The reviews at the time weren't fantastically complimentary (Mediocre Print quality). It uses Samsung's proprietary SPL (Samsung Printer Language) and the drivers haven't been updated in ages and those that exist aren't that brilliant - assuming you can get them to work (so Google informed me). However it would give me the opportunity to try things out and see whether I actually needed a colour printer.

Deployment

I wanted the printer to be networked. eBay found somebody in the USA selling a network interface card for the printer, but at a price that was four times what I had paid the printer itself! Anyway I also had the problem of the drivers to sort out.

As you may have seen elsewhere I have a small low power web server connected to my network. At the time of writing this is a Wyse C10 thin client. It would seem to be a good idea to connect the printer to one of the USB ports on this server and it could also act as a print server. So it was just a matter of finding and installing suitable software. Luckily this was not a difficult task - at least it didn't appear to be so at the outset but ended up taking a day to sort out.

Starting from the printer and working backwards...

SpliX Back in time (Aurelien Croc?) reverse engineered the Samsung Printer Language SPL and produced an open source Linux driver for the printer that integrated with CUPS (Common Unix Printing System). Details can be found on the SpliX project website, the Sourceforge Project Website and the Openprinting website. So the SpliX driver should handle the printer. Whilst no longer in mainstream development (petered out in 2009?) there still appears to be interest and maintenance work on the sources. The most recent versions can be found on the gitlab website. The CLP-500 is one of the various Samsung and Xerox printers it supports.

CUPS The CUPS sub system (Common Unix Printing System) is the print server software that can accept print jobs from client computers, process them, and send them to the appropriate printer. A key thing to note in the description is process them. The combination of CUPS and SpliX means our printer appears to the big wide world as a postscript printer.

Client Printer Driver As far as the client computers are concerned all we need to do is install a generic PostScript driver and point that at the print server. As noted above the combination of CUPS and SpliX deals with the printer specific stuff.

Prerequisites

This description starts from the point where you already have a small Linux server up and running. In my case this was a Wyse C10 thin client running Tiny Core Linux. How I set this up is described here. If you use something other than Tiny Core you'll obviously have to adjust some of what follows to suit your particular distribution. You may find that a version of SpliX is directly available in your distribution's repository.

If your distribution's repository does not include the drivers this article on the tinycorelinux.net website, (a website flagged by my antivirus software as 'dangerous' for some unknown reason) includes an explanation of how to extract the drivers from a .deb or .rpm packaged file. In my case I opted to build the drivers from source.

The version of CUPS from the Tiny Core repository turned out to be 1.6.2.

SpliX

Initially I fired up my Tiny Core development system to build the SpliX drivers. I found that in order to compile the drivers I needed to have the apps cups and cups-dev installed. It was a few seconds work with the App Browser get them installed.

Next you need the SpliX sources. Go to https://gitlab.com/ScumCoder/splix. In the download option (top right) I opted to download the tar.gz file and then unpacked it.

The Tiny Core apps repository does not include the JBIG compression library so compilation and installation are a matter of doing:

make DISABLE_JBIG=1
sudo make DISABLE_JBIG=1 install

There's also a useful command line setting of V=1 which I used with the 'install' command. This switches on verbose mode so you can see what files are being put where by the installer.

It installs two files (pstopqpdl and rastertoqpdl) into /usr/local/lib/cups/filter and a whole host of printers into /usr/local/share/cups/model. In my case I'm only interested in three files: samsung/clp500.ppd, samsung/clp500pt.ppd and samsung/clp500fr.ppd. (I'm not too sure what the last two are for, so I kept all three).

The documentation reads: "For color printers SpliX needs color profiles from the printer's manufacturer, otherwise it will refuse to print." In my first trial it worked without these profiles, however I decided to add them for completeness. The suggestion is that you can copy the colour profiles over after installing the manufacturer's own software. In my case I used a file from the SpliX site: http://SpliX.ap2c.org/samsung_cms.tar.bz2 which supplied me with the CLP-500cms and CLP-500cms2 files. In practice these files live in the /usr/local/share/cups/profiles/samsung/ directory.

The final step is to collect up the files we've built:

cd /usr/local
tc@box:/usr/local$ sudo tar -cvf /tmp/splix.tar lib/cups/filter/*toqpdl share/cups/profiles/samsung share/cups/model/samsung
lib/cups/filter/pstoqpdl
lib/cups/filter/rastertoqpdl
share/cups/profiles/samsung/CLP-500cms
share/cups/profiles/samsung/CLP-500cms2
share/cups/model/samsung/
share/cups/model/samsung/clp500pt.ppd
share/cups/model/samsung/clp500fr.ppd
share/cups/model/samsung/clp500.ppd
tc@box:/usr/local$ 

This produces the file splix.tar that can be moved across and installed on the server. (You can download a gzip'd version from here).

Server Installation

Use the Apps Browser (either GUI or tce-ab for a command line install) to install:

  • cups-dev.tcz
  • cups.tcz
  • bc.tcz

Note: bc is an arbitrary precision calculator that is not included as part of the standard Tiny Core installation. However it is used by some of the cups filters and without it in place they won't run. (This was one of the several problems I encountered along the way and took me some time to track down).

Next copy over the files built on development system. It's just a matter of extracting the files from the tar ball created earlier into the /usr/local directory. In my case I moved the file across on a pendrive that was then mounted on /mnt/sdb1.

tc@mirror:/home/ptowers$ cd /usr/local
tc@mirror:/usr/local$ sudo tar -xvf /mnt/sdb1/splix.tar
lib/cups/filter/pstoqpdl
lib/cups/filter/rastertoqpdl
share/cups/profiles/samsung/CLP-500cms
share/cups/profiles/samsung/CLP-500cms2
share/cups/model/samsung/
share/cups/model/samsung/clp500pt.ppd
share/cups/model/samsung/clp500fr.ppd
share/cups/model/samsung/clp500.ppd
tc@mirror:/usr/local$

The next steps are to fire up the CUPS daemon and install the printer. The installation/management process is quite simple and managed via a web interface. As with most daemons the CUPS daemon behaviour is governed by a configuration file (/usr/local/etc/cups/cupsd.conf). This needs to be setup correctly. A lot of the settings can be tweaked just by running the command cupsctl with suitable arguments.

This is another area where I went round in circles for a while....

My server, as it runs headless, does not run a GUI and did not have any browser installed so my preference was to use remote administration.

Firstly I had a problem connecting to the server. With my set up the server is always handed an IP address of 192.168.10.12 by my dhcp server. On my Windows box I have an entry mapping that to the name 'ptowers'. So http://ptowers/thin for example gets me straight to the thin client pages of the mirror of this website. Pointing my browser at http://ptowers:631 brought up the response Bad Request. I found that by using the actual IP address in the URL (http://192.168.10.12:631) it worked and brought up the front page of the CUPS administration. However when I went to add a printer I got a page saying: Upgrade required and that I must access the page:

..using the URL https://192.168.10.12:631/admin/

...which I was doing and which resulted in a 'web page not available' message from the browser.

Finding these barriers to my using remote administration I temporarily enabled the GUI on the web server box and installed a browser. This let me try things out using 'localhost'. Subsequently I tracked down the errant behaviour to something to do with the automatic generation (or not!) of a server certificate. There are apparently two solutions: (1) Manually generate the certificate using openssl, or, (2) Turn off the encryption. As my local network is a benign environment I took the latter approach (see below).

One final point. In order to be able to configure the printer you need to be able to log on as an administrator and the logon procedure requires a password. In Tiny Core, unless you've changed things, there is no password for root. (You can't logon directly as root and have to get there using sudo from an authorised user account). The simplest thing is to temporarily set a password for root (sudo passwd). I set it to 'splix'. Note that with Tiny Core, as it runs from RAM, this will be thrown away the next time you reboot the server unless you take steps to preserve the change.

So in all of this the first thing to do is a couple of edits to the file /usr/local/etc/cups/cupsd.conf. At the beginning of the file add the line:

DefaultEncryption Never

The next change is optional but you might need to do it at some point. Near the start of the file find the entry:

LogLevel warn

and change it to

LogLevel debug

It was by using this I found that the command bc was required. The relevant log where all the detailed information can be found is /var/log/cups/error_log. Once you are happy that all is well you can reset the LogLevel to 'warn'.

Ok, now's the time to fire up the daemon and enable the remote administration. Just run the two commands:

tc@mirror:/usr/local$ sudo /usr/local/etc/init.d/cups start
tc@mirror:/usr/local$ sudo cupsctl --remote-admin

At this point you should connect the printer to the server.

usb 1-3: new high-speed USB device number 5 using ehci-pci
usblp 1-3:1.0: usblp0: USB Bidirectional printer dev 5 if 0 alt 0 proto 2 vid 0x04E8 pid 0x3248
usbcore: registered new interface driver usblp
tc@mirror:/usr/local$

Configuration

Installing/configring the printer is straight forward with CUPS using the browser interface. It is just a matter of working through the various screens and saving the end result. As noted above I had to use the IP address of the server to do this: http://192.168.10.12:631. (Your mileage may vary). At one point you set the printer queue name. CUPS defaulted to Samsung_CLP-500, but I opted to change it to SamsungCLR. (My earlier 'googling' found some people attributing problems to having queue names longer than 12 characters - but I think this was when trying to share via samba. Probably complete claptrap but at the time I was willing to try almost anything).

When I moved on to setting the printer up on my Windows system it took me a lot longer. The following description applies to Windows 7. I assume other versions will be similar.

My first mistake was to assume that as I couldn't see the printer on the network I must have something wrong with my installation. I wasted some time poking around this problem (including shortening the queue name!) before I realised everything was actually ok. I have no idea whether the printer should be visible or not, all I know is that in my case it isn't.

In Windows it is just a matter of going through the 'Add printer' process and select the option for a network printer. Windows will then search for printers and not find the new printer.

Printer install screen 1

Click on 'The printer that I want isn't listed'.

Select the option to select a shared printer by name and type in the path to the printer as shown:

Printer install screen 2

Obviously you will want to replace SamsungCLR by whatever name you gave to your print queue. Windows should then connect to your print server...

Printer install screen 3

..and then move on to wanting to install a local print driver for it.

Printer install screen 4

What I did at this point was find an arbitrary colour postscript printer and installed the driver for that.

Printer install screen 5

That should be it.

Preserving Your Efforts

With Tiny Core all your hard work in getting the printer set up is sitting in RAM and will vanish when you next power off or reboot so you need to make the changes permanent. The Tiny Core Wiki article shows two ways to do this: (1) by adding the files to /opt/.filetool.lst, or (2) by creating your own tcz extension. I decided to try the second option.

First we need to identify all the files we need to preserve. These are all in the /usr/local directory. The steps below show how to build up the files in /tmp/samsung and then build the extension.

Note: To build the extension we'll need mksquashfs so, if you don't already have it loaded, use the App Browser to load squashfs-tools-4.x.tcz.

Next we need to build the file tree containing the driver files we added, the CUPS configuration file and all files that were created when we installed the printer. (In working out how to create the tree with the minimum of effort I discovered the --parent switch in cp which keeps the file path when creating the copy of the file.)

root@mirror:/tmp# mkdir samsung
root@mirror:/tmp# cd samsung
root@mirror:/tmp/samsung# cp -p --parent /usr/local/lib/cups/filter/*qpdl .
root@mirror:/tmp/samsung# cp -p --parent /usr/local/share/cups/profiles/samsung/* .
root@mirror:/tmp/samsung# cp -p --parent /usr/local/share/cups/model/samsung/clp500* .
root@mirror:/tmp/samsung# cp -p --parent /usr/local/etc/cups/cupsd.conf .
root@mirror:/tmp/samsung# cp -p --parent /usr/local/etc/cups/printers.conf .
root@mirror:/tmp/samsung# cp -p --parent /usr/local/etc/cups/ppd/* .
root@mirror:/tmp/samsung#

Running find can let you check that you've copied over the right files.

root@mirror:/tmp/samsung# find . -print
.
./usr
./usr/local
./usr/local/etc
./usr/local/etc/cups
./usr/local/etc/cups/ppd
./usr/local/etc/cups/ppd/SamsungClr.ppd
./usr/local/etc/cups/printers.conf
./usr/local/etc/cups/cupsd.conf
./usr/local/share
./usr/local/share/cups
./usr/local/share/cups/model
./usr/local/share/cups/model/samsung
./usr/local/share/cups/model/samsung/clp500pt.ppd
./usr/local/share/cups/model/samsung/clp500fr.ppd
./usr/local/share/cups/model/samsung/clp500.ppd
./usr/local/share/cups/profiles
./usr/local/share/cups/profiles/samsung
./usr/local/share/cups/profiles/samsung/CLP-500cms2
./usr/local/share/cups/profiles/samsung/CLP-500cms
./usr/local/lib
./usr/local/lib/cups
./usr/local/lib/cups/filter
./usr/local/lib/cups/filter/rastertoqpdl
./usr/local/lib/cups/filter/pstoqpdl
root@mirror:/tmp/samsung#

When you're happy you've collected up all the files it's time to build the extension:

root@mirror:/tmp/samsung# cd /tmp
root@mirror:/tmp#
root@mirror:/tmp# mksquashfs samsung/ samsungCLP500.tcz
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on samsungCLP500.tcz, block size 131072.
[==========================================================================-] 15/15 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments, no xattrs
        duplicates are removed
Filesystem size 246.95 Kbytes (0.24 Mbytes)
        28.19% of uncompressed filesystem size (876.13 Kbytes)
Inode table size 356 bytes (0.35 Kbytes)
        42.69% of uncompressed inode table size (834 bytes)
Directory table size 302 bytes (0.29 Kbytes)
        54.61% of uncompressed directory table size (553 bytes)
Number of duplicate files found 1
Number of inodes 25
Number of files 10
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 15
Number of ids (unique uids + gids) 3
Number of uids 2
        root (0)
        tc (1001)
Number of gids 2
        root (0)
        staff (50)
root@mirror:/tmp# ls -l samsungCLP500.tcz
-rw-r--r--    1 root     root        253952 Apr 14 09:01 samsungCLP500.tcz
root@mirror:/tmp#

Next add the command to start CUPS to the bootlocal.sh file.

root@mirror:/tmp# cd /opt
root@mirror:/opt$ echo /usr/local/etc/init.d/cups start >>bootlocal.sh
root@mirror:/opt$

Finally there is the matter of installing the extension. I believe this should be possible using tce-audit but I couldn't find any documentation on the command. I soon gave up trying to work out how to use it and just did things manually:

root@mirror:/tmp# cp samsungCLP500.tcz /mnt/sda1/tce/optional/
root@mirror:/tmp# echo samsungCLP500.tcz >>/mnt/sda1/tce/onboot.lst
root@mirror:/tmp# 

Note: My server runs with a permanent /opt directory. If yours is in RAM you'll need to run filetool.sh -b to preserve the change in the mydata.tgz file.

Resources

A couple of links that helped me along the way:

Wiki
Tiny Core Forum

 


Any comments? email me.    Last update April 2015