Fred's Home Page

Main
About me
Crumble
csh is bad
Debian
FredCam
Guppy
Hardware
Help out
Java-glossary
Job-control
KRoC/Linux (old)
Lambda
Life-stuff
Links
Linux
Mesh
Misc
Music
occam
occam upgrades
occam tutorial
OpenUPSd
Pictures
Programming
Projects (PhD)
Publications
Quick gdb
RAPP
RMoX
Software
UNIX crashcourse
UWG
UWGBuilder
WG / WGBuilder
XDM-Choose
XHPD

Linux

[ preface | printing | parport | patches | clones | stuff ]

preface

I'm still kinda working on this page, but there again, my webpages are always in a state of change.

Printing in linux

(or how to hack your print system into submission)

Having just hacked our print system into submission (and spending quite a while doing it), I thought it might be worth sharing some of the code/experience. We have an HP DeskJet 520 connected to the machine known as ``lothlorien''. Being a deskjet, it likes PCL (3rd flavour in this case). Thankfully, ghostscript supports this version of the printer and there's lots of information about setting this up on this page.

Since the printer supports various levels of output quality (with the -sPrintQuality=... option to ghostscript), we have setup 3 postscript print queues and 1 regular ``lp''. One print queue for regular output (called `hp'), one for draft output (called `hp-draft') and one for presentation (!) quality output (called `hp-best'). To turn postscript into PCL I hacked out a small filter program which does all the necessary gs work, although it may be relatively site-dependant. This single filter is designed to handle all three postscript queues, depending on how it gets invoked. On lothlorien, the real script is /usr/local/bin/zog-hp, with /usr/local/bin/zog-hp-draft and /usr/local/bin/zog-hp-best as symblinks to it.

The printcap file on lothlorien is pretty simple, mostly copy-and-paste of the existing defaults. The printcap files on other machines just re-direct jobs to lothlorien. We've handled authentication control by putting the names of other machines in lothlorien's /etc/hosts.lpd file.

So, here are the various files; the zog-hp script is a bit hacky, but it works :).

  • zog-hp (3.5k), print filter to drive the deskjet in various quality modes.
  • printcap-lothlorien (1.2k), /etc/printcap from lothlorien.
  • printcap-frog (1.2k), /etc/printcap from frog (one of the machines allowed to remote-print).

To print off my machine frog, say, it's simply a case of the regular ``lpr -Php-best somefile.ps''. The zog-hp script has a reasonable job at making sure the job is decent postscript (first by checking using `file | magic2mime' for `application/postscript', then by checking the return status of ghostscript). If a job fails, the filter returns 2 (JABORT) to have the job removed from the queue. If the job failed while being processed by ghostscript (broken postscript), the ghostscript messages are output (which will get mailed to the person who generated the job). A handy reference on print filters can be found here.

Parport stuff

I've recently (well, not so recent now) taken to trying to fix some bugs in the parport driver for Linux. The parport stuff is looked after by Tim Waugh and others, and the page about it can be found here. My offerings have been the odd fix and improvement/enhancement here and there.

Various patches

Here are some other random patches for the linux kernel:

2.2.14

  • bigphysarea-2.2.14 This is a device driver which lets you allocate large chunks of physical memory. The driver page is here.
  • bigphysarea-2.2.14-5.0 version of the above for RedHat kernels
  • smp-locking These are some hacks I did to lock processes to processors in an SMP machine. Use of sysmp() [below] is preferred (only 2.3.x kernels tho).

2.3.36

  • pset + bigphysarea This is two patches in one. One being bigphysarea as mentioned above, the second being Tim Hockin's PSet (processor sets) patch. Information about psets can be found here. pset basically allows you to do cool stuff with an SMP machine (like restricting a process to a CPU).

2.3.42

  • pset + bigphysarea Another 2-in-1 patch. Includes pset/sysmp and bigphysarea. bigphysarea is on the config menu, so it can be disabled and thus not compiled in. Compressed version

2.3.47

2.4.7

2.4.18

Other UNIXen for PCs

  • Linux (debian, redhat, slackware, SuSE, Turbo-linux, SE-linux, mandrake, and others)
  • FreeBSD / OpenBSD / NetBSD
  • Minix
  • Sun Solaris x86

If NT is the answer, you don't understand the question.

Other Linux stuff

  • Patches for the 2.0.37 linux kernel to lock processes onto processors (in an SMP environment).
  • The Dining Philosophers - an animated collection of 5 philosophers fighting over spaghetti (Linux binary - c50K).
Last modified: 2003-11-01 12:49:47.000000000 +0000 by Fred Barnes [ls] [plain]
Page generated: Sun Apr 28 11:39:32 2013
Valid XHTML 1.0! Valid CSS!