R.F. Bevan & Co.

Notebook

Adding a Virtual Printer to CUPS

Wednesday, 6th July 2011


Our print-to-fax setup is made up of a virtual network printer that accepts postscript input and runs it through a shell script that parses it for its destination address before shunting it to either the fax or email. Setting it up is relatively simple:

  1. Create a CUPS backend script like this one and place it into /usr/libexec/cups/backend. Make sure that it is executable.
  2. Restart CUPS and test that the backend is available by issuing the command:
    sudo lpinfo -v
    It should return a list of the backends of which ours (faxmail in this case) should be one.
  3. Enter the CUPS administration page and add the new virtual printer. The device URI will be faxmail:/

The script currently just dumps the postscript files into the temporary directory for later work by a cron job. A much better example is pdf2email by George Notaras.

Dongle Woes

Saturday, 2nd July 2011


I bought a Startech USB-to-serial dongle for use with a voice modem that I am using to give telemarketers the 'voicemail treatment' - a ghastly pre-recorded message that saves me the chore of having to listen to them punt their crap. However, I misread the reviews of the dongle and mistakenly believed that it was Linux compatible out-of-the-box. Unfortunately, that was not the case.

Fortunately, a little investigation found that the device has a Texas Instruments TI USB 3410 chipset, which is supported in the Linux kernel. The problem is that the driver does not recognise the USB id of this particular device.

After editing /usr/src/linux/drivers/usb/serial/ti_usb_3410_5052.h and changing the line:

#define TI_VENDOR_ID                    0x0451

to

#define TI_VENDOR_ID                    0x14b0

the device seems to work, although it fills the error log with messages about nonzero urb status, so I patched the kernel to stop those.

Jewellery Renders With Luxrender

Friday, 3rd June 2011


I have started rendering some of the letter pendants using Luxrender. I set up a simple virtual lightbox by working backwards from the reflection in a photo of a pair of Tiffany cufflinks. The result went quite well, and so now I can use the same lightbox for all manner of renders.

In order to extract the subject from its background, I first rendered the image as normal, and then re-rendered it with the background items removed soley to create an alpha channel that can be used as a layer mask. The mask then serves a dual purpose: It can be used to extract the subject, but it can also be used to mask the subject to leave behind the shadow, which is easily isolated by adjusting the levels and then using the color to alpha command to leave behind just the shadow on its own layer.

The resulting subject and shadow can then be saved as a PNG with transparency that is reasonably independent of the background colour, which gives us a bit of freedom to use the image on future designs, whether the background is pure white or not.