Well, I still can’t find any software which will allow me to use the standard HP drivers with the DeskJet. (See parts one and two for the explanation). But, there’s another open-source alternative to Gutenprint’s HP driver: HPIJS – which works great! It’s still not brilliantly fast, but it supports multiple paper types, and most importantly, duplex printing – so I’m happy!
Archive for May, 2008
Part two of my saga of trying to get my HP DeskJet 940C to print nicely from MacOS X despite it being attached to my ReadyNAS. Bonjour Browser, we can see that the Airport Express is advertising:
- _pdl-datastream._tcp., a “Printer PDL Data Stream”, and
- _riousbprint._tcp., a “Remote I/O USB Printer”
So, not IPP at all.
What we need to do, then, is get the ReadyNAS to advertise itself as a remotely controllable USB device, instead of (as well as?) an IPP printer. But do we need _pdl-datastream, or _riousbprint, or both?
Specifically, this is how it appears over Bonjour from the AirportExpress:
_pdl-datastream._tcp. 192.168.0.6:9100 txtvers=1 qtotal=1 note=Living Room product=(HEWLETT-PACKARD DESKJET 940C) pdl=application/vnd.hp-PCL priority=5 usb_MFG=HEWLETT-PACKARD usb_MDL=DESKJET 940C usb_C ty=HEWLETT_PACKARD DESKJET 940C _riousbprint._tcp. 192.168.0.6:10000 txtvers=1 qtotal=1 note=Living Room product=(HEWLETT-PACKARD DESKJET 940C) rp=HEWLETT-PACKARD DESKJET 940C HU1B96N1ZZBH pdl=application/MLC,application/PCL,application/PML priority=1 usb_MFG=HE
Well, looking at a Wireshark dump of the transaction, we’re talking to port 10000: the remote USB service. Unsurprising, really. To be honest it’s more surprising that the Airport Express provides the other service (which makes it look like an HP JetDirect to PCs, I suppose).
So, we “just” need a package we can install on the ReadyNAS using apt, which exposes the USB device using this protocol. Sadly I can’t find such a Linux project, and nor can I find documentation on the protocol so I can’t have a go at writing one myself. Which is probably a good thing, as I have more important things I should be doing!
Summary: it’s not impossible after all, somebody just needs to write some software!
I’ve just bought a ReadyNAS NV+, a NAS box onto which I will do all my backups. It’s great: amongst other things you can log into it using SSH, and use apt-get to install packages, which opens up lots of opportunities such as running my Subversion server on it.
I also wanted to share my old-ish HP DeskJet 940C inkjet from it. Upon connecting it to the USB port on the ReadyNAS, it appeared in Bonjour and I was able to print with it from my Mac – but only using the Gutenprint driver, rather than HP’s own driver. This was not a problem when it was attached to my old Power Mac G4 sitting in the corner… but I’d hoped to retire that. Unfortunately, the Gutenprint driver is slower, doesn’t support different types of paper, nor duplex. It’s good, but it’s not good enough.
I’ve spent a couple of hours researching the problem and have concluded that it’s impossible to solve. Here’s my reasoning. If anyone can find a way round these problems that would be terrific!
How printing works on MacOS X
MacOS X uses a printing system called CUPS. This knows about the printers installed, and manages queues of documents for them. You can control CUPS using the Printers preference page, or by logging into your own Mac on port 631 using a web browser.
The settings for each CUPS printer consist of three things behind the scenes:
- An entry in /etc/cups/printers.conf which says very little except…
- A URL to which the printer data should be delivered
- A PPD (Postscript Printer Description file) in /etc/cups/ppd
The key part is the PPD. This specifies all the capabilities of the printer. It also specifies how to process the data for the printer… and this is done in terms of the “cupsFilter” element. It describes whether the printer can accept a given MIME type directly. If not, it can also specify that the printer can accept that MIME type if the data is fed through a certain programme. CUPS will chain together these “filters” to convert from the original data type to one which the printer can actually accept. For example,a PICT image might be converted to PDF, then to a general bitmap, then to a bitmap format suitable for the printer.
Here are the cupsFilter details for my HP DeskJet 940c…
|Gutenprint||Over IPP to ReadyNAS||*cupsFilter: “application/vnd.cups-raster 100 rastertogutenprint.5.1”|
|HP||Locally over USB||*cupsFilter: “application/pdf 0 /System/Library/Printers/Libraries/PrintJobMgr/Contents/MacOS/PrintJobMgr”|
|IPP to my Mac G4||*cupsFilter: “application/pdf 0 -“
*cupsFilter: “application/pictwps 0 -“
*cupsFilter: “image/* 0 -“
So, for Gutenprint, a general CUPS raster (which CUPS intrinsically knows how to accept) is converted by the program “rastertogutenprint5.1” to the data format specific for the printer. CUPS then sends that across the network to the ReadyNas, and all is well.
If you’re using the standard HP driver locally, it uses a command “PrintJobMgr” to send the data to the actual printer. This takes a PDF and does something to convert it to HP’s format.
If you’re using an HP printer connected to a remote Mac, things are very different – it just sends the PDF, PICT or any image format directly to the other Mac – which will then send it through CUPS again, eventually resulting in a PDF form of the data making its way into PrintJobMgr on that distant Mac.
So what’s this mysterious PrintJobMgr? Unfortunately that’s where it all gets a bit depressing. Back in the early days of MacOS X (before 10.2) it didn’t use CUPS – instead it used a “Printer Manager” framework, codenamed Tioga. It appears that PrintJobMgr is a call from CUPS into that older system. That means, the process of converting from PDF (etc.) to the HP-specific data stream is not embedded in a nice executable which we can call from a cupsFilter before sending the data to the ReadyNAS. There’s simply no way to get the data out of the HP driver so that we can send it across the network.
So the HP driver is out – we’d have to run it on the ReadyNAS which means we’d have to run OS X on the ReadyNAS.
What about using “gutenprint.5.1” to convert to the HP data format, but using the rest of the HP PPD file to configure the available options? I haven’t tried this, but I think it’s a non-starter. According to the Gutenprint user’s manual, the rest of the PPD is very specific to the Gutenprint driver. It specifically says that rastertogutenprint5.1 will fail if you use a PPD other than the one which comes with Gutenprint.
Unfortunately, it seems that to use a DeskJet attached to the ReadyNAS we have no choice but to use Gutenprint.
Update: it’s just occurred to me that the Airport Express is supposed to support printer sharing. I can’t believe it’s running the HP printer driver internally. So perhaps there’s a way… more on that later!