How to Use Dynamic PPD's in CUPS

Problems and successes with specific brands/models of printers
Post Reply
Message
Author
User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

How to Use Dynamic PPD's in CUPS

#1 Post by rcrsn51 »

Users of CUPS 1.1.23 are familiar with the concept of a static PPD file. Just to be clear, a Postscript Printer Description file is not a printer driver. It is a text file that contains configuration data used by the corresponding driver to process a print job.

Printer drivers can be found in several places. The most basic drivers are compiled inside Ghostscript, which is the main engine of the Linux printing process. If your printer uses one of these drivers, you must get the matching PPD file from linuxprinting.org. You then save the file in /usr/share/cups/model and install the printer.

In Puppy 4.0, BarryK implemented Gutenprint drivers. The printer wizard /usr/sbin/cups_shell generates the set of Gutenprint PPD's and stores them in a subfolder of /usr/share/cups/model. Once a printer is installed, all the PPD's are deleted to save space. This works because the selected PPD is transfered to a permanent location in /etc/cups/ppd.

If a printer uses the HPIJS driver, the PET installer stores a large collection of PPD's in /usr/share/ppd. There is a symlink in /usr/share/cups/model that points to this folder so CUPS can find them.

When you add a printer, CUPS shows you two lists titled Make and Model. These lists are generated by CUPS from all the PPDs that it can find on your system. However, having an appropriate PPD does not guarantee that you also have the necessary driver required by your printer.

In CUPS 1.2, dynamic PPD's were introduced. These files are generated on-the-fly so there is no need to have a permanent store of static PPD's on your hard drive.

In Puppy 4.2, the Gutenprint PPD's are now dynamic. When CUPS is launched, it starts a daemon called cups-driverd. It looks for static PPD's in the usual places, then goes to /usr/lib/cups/driver and finds the Gutenprint PPD generating program. The individual PPD's are created from XML data located in /usr/share/gutenprint/5.2. If you look at the cups_shell script in Puppy 4.2, you will notice how the cups-genppd.5.x program is no longer invoked to make static PPD's.

This brings us to HPIJS. In addition to downloading its static PPD's, the HPIJS installer also saves the file /usr/share/cups/drv/hp/hpijs.drv. This is the database for building dynamic HPIJS PPD's. So in Puppy 4.2 with CUPS 1.4b, you can delete all the static PPD's in /usr/share/ppd and CUPS will still add a printer. But if you look in /usr/lib/cups/driver, there is no corresponding PPD generator program! This is because the 1.4b cups-driverd daemon contains the code needed to construct dynamic HPIJS PPD's.

But what if you want to downgrade to the stable CUPS 1.3.9? In that case, you need to manually install the HPIJS PPD generator. It comes from the CUPS Driver Development Kit and is contained in the cupsddk-1.2.3-i486.pet attached to this document. Here is how to get it working:

Go here and follow the steps for setting up CUPS 1.3.9. This will include installing the HPIJS PET from the Puppy Package Manager and applying the Foomatic -U patch.

Go to /usr/share/ppd and delete the hp folder containing the static PPD's.

Install the cupsddk-1.2.3-i486.pet. Now when you look in /usr/lib/cups/driver, you will see a program called "drv". This is the HPIJS PPD generator.

Go to the /tmp folder and check its properties. The permissions must be set to all-writable.

Restart CUPS and install a printer.
Attachments
cupsddk-1.2.3-i486.pet
(186.12 KiB) Downloaded 1121 times
Last edited by rcrsn51 on Thu 14 May 2009, 14:05, edited 8 times in total.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#2 Post by DaveS »

Can you think of a downside to doing it this way?
Spup Frugal HD and USB
Root forever!

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#3 Post by DaveS »

Worked perfectly. Operation gave back 2MB of pupsave space. /tmp permissions were already correct on my system. Thanks for this, it makes things a bit easier to understand. For me, printing on 4.2 has gone from being poor to being excellent. Heck, I can even cancel a job now!
I am using an HP Photosmart C4380 wifi printer.
Spup Frugal HD and USB
Root forever!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#4 Post by rcrsn51 »

Glad to help.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#5 Post by DaveS »

Question please: if I continue with the static drivers, can I go in to /usr/ppd, and delete all the drivers EXCEPT the one specific to my printer? Just curious. Seems from what you say that I can........
Spup Frugal HD and USB
Root forever!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#6 Post by rcrsn51 »

Once you have installed a printer, its PPD file is transferred to the folder /etc/cups/ppd and given the name that you selected to define the printer. So you can delete ALL the PPD files in /usr/share/ppd.

This is what happens automatically in Puppy 4.1.x with static Gutenprint PPD's via the cups_shell script. In the case of HPIJS, you would have to reinstall the PET package to get the static PPD's back if you needed to change printers. But if you have the dynamic PPD generator in play, they would always be available.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#7 Post by DaveS »

I ran this on one of my 4.2 systems, basically just installing the hpjis package, then deleting /ppd. I updated the filter with -U, and installed my printer via the wizard, keeping CUPS 1.4b2, but installed the fixed config file. So far so good, but printing is def slower than 1.3.9. Interestingly, the interface for CUPS is also olive colored, which I guess comes from the .config file :D
So question: The -U mod is key in making this work. Is there a situation in 4.2 where making that mod would cause problems? Could it be done by default in the iso? Do you think hpijs minus ppds should also be in the default .iso?
ps: 1.4b2 finds my network printer automatically, though I chose to install it manually. Will have a go later today at accepting the 'found' printer, which previously failed to work. 1.3.9 cannot do this, so I guess when the bugs get ironed out, 1.4 will be easier for beginners.
Spup Frugal HD and USB
Root forever!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#8 Post by rcrsn51 »

The -U patch is being applied to the file foomatic-rip-hplip which is part of the HPIJS PET. The file does not exist in the standard ISO.

Since the file is only used by HPIJS/HPLIP devices, I can't see any downside to patching it.

The better solution is for the maintainer of the HPIJS package in the repository to apply the patch there. In fact, it may be possible to compile HPIJS to eliminate the need for this file altogether and use the new version of Foomatic in Puppy 4.

However, in the same way that Gutenprint is now included in Puppy, it would make sense to add HPIJS with dynamic PPD's. But I expect that such an addition would put Puppy over the magic 100 MB mark, so there might be some resistance.

Your observation about printing being slower in 1.4b2 than in 1.3.9 is interesting. Most of the problems I have observed were related to adding/modifying/deleting a printer, not when it was in actual use.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#9 Post by rcrsn51 »

As a test, I compiled a version of HPIJS that has dynamic-only PPD's and doesn't use foomatic-rip-hplip.

I ran it in Puppy 4.2.1 downgraded to CUPS 1.3.10 with the "drv" add-on installed to enable dynamic PPD's. It works fine and doesn't need any -U patching.

The current hpijs-static PET from the repository is 2737 KB. My dynamic-only PET is 577K. Uncompressed, it adds about 2 MB to the size of Puppy.

There may be a caveat to this. It looks like HPIJS must be compiled against the specific version of CUPS with which it will be eventually run. But if it was included with Puppy, that wouldn't matter.
Last edited by rcrsn51 on Mon 27 Apr 2009, 17:00, edited 2 times in total.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#10 Post by DaveS »

Certainly if it were included at .iso it would dramatically widen the number of printers that would set up trouble free. I ran the auto-detect install process and it found my printer, and after installation it prints just fine (1.4b2). So far so good. Will try abusing it and doing stupid things to check on how robust it is.................
Spup Frugal HD and USB
Root forever!

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#11 Post by DaveS »

Proving very robust. Deleting/installing printers, deleting jobs, installing auto-detected printers, modifying printers all trouble free with no log in rqd. Cool.
Spup Frugal HD and USB
Root forever!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#12 Post by rcrsn51 »

I'm curious. After you have modified/deleted printers, what happens when you add a new one? What does your list of Manufacturers look like? Because mine repeatedly gets scrambled/duplicated. This is with 1.4b2.

Also, a Modify operation will always hang up on my system.
the interface for CUPS is also olive colored
Are you sure that you're running CUPS 1.4b2?

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#13 Post by DaveS »

rcrsn51 wrote:I'm curious. After you have modified/deleted printers, what happens when you add a new one? What does your list of Manufacturers look like? Because mine repeatedly gets scrambled/duplicated. This is with 1.4b2.

Also, a Modify operation will always hang up on my system.
the interface for CUPS is also olive colored
Are you sure that you're running CUPS 1.4b2?
Definitely 1.4b2. Even if the listing at the top of the window were somehow wrong, the interface and especially the options are different from 1.3.9. Yes the list gets scrambled/duplicated also the available drivers are listed twice. The system does not hang after/during modify process though.
Spup Frugal HD and USB
Root forever!

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#14 Post by rcrsn51 »

Now I see where the olive colour comes from. I'm betting that you installed 1.3.9, then uninstalled it to get back to 1.4b2. The background colour is an artifact.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#15 Post by DaveS »

rcrsn51 wrote:Now I see where the olive colour comes from. I'm betting that you installed 1.3.9, then uninstalled it to get back to 1.4b2. The background colour is an artifact.
Correct. Wonder if any other effects of that are being felt.
Spup Frugal HD and USB
Root forever!

Post Reply