Files
hpr-knowledge-base/hpr_transcripts/hpr0269.txt

246 lines
22 KiB
Plaintext
Raw Normal View History

Episode: 269
Title: HPR0269: Cups
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0269/hpr0269.mp3
Transcribed: 2025-10-07 15:07:04
---
.
.
.
Hi everyone, this is Klaatu, this is Hacker Public Radio.
I'm going to talk about a common Unix printing system, which is a really versatile and flexible
or not flexible, but robust system for scheduling and schooling print jobs.
There are front-ends to cups that you can use in GNOME or KDE and other environments,
but the neat thing about getting familiar with both cups and the way that something is printed
is that no matter what system you're on, as long as it's Unix or Unix-like,
chances are it's using the cups system in the background and if you're familiar with it,
that you can really juggle around printers and network printers and things like that.
So cups was started back in 97, I think it was released officially in 1999, and it's been
going strong ever since, and I think around 2007, Apple computers were Apple-incorporated,
they hired the main developer of cups and they purchased his company or the code or whatever.
I believe it's still under GPL2, I haven't seen anything about it not being under GPL2,
so I think that it's all still GPL'd, but it's kind of a linchpin right now of how the Mac OS prints
at all. If I'm not mistaken, early early in OS 10, around 2000-ish, they were really
when they switched over from OS 9 to 10, if memory searched correctly, they had real problems
printing. They did not have a really good solution for printing yet, and that was kind of an issue,
as you can imagine, and from what I understand, cups kind of saved them in a big way, it really,
really kind of helped them, so not surprising that they would want to, I guess, own or pone the code
that is cups. Regardless of that of who's funding it or whatever,
is something that you're going to find in most, probably every Linux distribution out there,
BSD, you know, all the Unix and Unix-like systems are using cups. Cups typically uses,
where it is able to use the Internet Printing Protocol in order to get things done,
and this means basically that you can set up a printer anywhere on your network and send jobs
out to it pretty easily. So we're talking you can either put a, you know, you can set up a printer
on your computer via a USB cable, or you can, you know, ethernet the printer to a router or something,
or USB it into a router, you know, just to, whatever options you've got, as long as that printer has
a, you know, there's a location for that printer, whether it's IP or like a socket,
you're, you can send a job out to it. Now, cups is not a driver system. Cups is the scheduler
and spooler, and this is where it kind of gets into sort of how does something get from, you know,
your brain onto paper. Well, what happens is that you as the user send out a job to the scheduler
or the spooler, in this case, cups, it applies whatever filter it needs to apply to it,
meaning that it needs to understand what type of information you're giving it, you know,
is it text, is it a graphic, is it, you know, does it need, is it vectors, is it bitmap,
does it need to be rasterized, all these different things, these are, these are, these are filters,
and the filters that you've probably heard of would be, for instance, like post script,
but then there's other filters out there, like, well, Fumatic uses, you know, as a filtering system,
ghost script converts things to post script. A lot of different, I don't know if they're
called back ends, I guess they're just really filters that takes the data as the computer understands
it and kind of translates it into an intermediary format that will, that will kind of translate
into printer data. The printer data is then sent to the back end, and there are many different
back ends, there would be, like, if it's a parallel printer, that parallel protocol would be the
back end serial, USB, various network back ends, like IPP, JetDirect, also called AppSocket,
Samba, LinePrincerDamon, LPD, so these, these back ends actually get the data onto paper for you.
Now, as you probably know, in order for your computer to be aware of a peripheral device,
like a printer, it's got to have a driver loaded into its kernel, it needs to know
that that thing exists outside of itself. Now, Cups is not, like I say, it's not the driver,
it's just a scheduler in schooler, so before you go hooking up your printer to your computer,
you're going to need to make sure that there's a driver. Now, luckily for us, most modern,
most major Linux distributions already have sort of the catch-all drivers included in them,
and the catch-all drivers that typically are going to make a printer run practically no matter
what are things like Guten, Print, and Fumatic. Both of those do really well with
getting, you know, recognizing that yes, this device is a printer, it's going to understand,
you know, a certain number of sort of common commands or common calls, and so it will, you know,
you can, these days you can pretty much plug a printer in to either a Linux box or even a Mac
box, and if you go through Cups, you know, you'll probably find some kind of driver that you can
use to drive this printer, and you can just start printing. So it's really, it's getting pretty
easy at this point, in most cases, at least in the cases that I've used. I don't use very fancy
printers, so if you're, if you're a publishing house listening to this, you might think I'm crazy.
The difference between, for instance, the kind of the, you know, the Guten Print and the Fumatic,
kind of generic, I guess, drivers would be that they, they're not going to necessarily,
they're not going to necessarily give you all the fancy bells and whistles that the printer might
have advertised. So, for instance, you've got the, you know, if you've got like a printer that does,
I don't know, let's say, do, it prints on both sides of the paper, I think that's called Duplex,
I could be wrong. If you've got a printer that does that, well, if the printer company wrote a
Linux driver for it, then when you plug that printer into either Linux or Windows, they're both
going to give you that option. You're going to be able to do both sides of the paper, or maybe there's
a special CPF filter so that you can just print your photo and to look like one of those aged
CPF tone photos. If you're not using the company driver and you're just using one of these generic
ones, it might not, it might not have that functionality, it might not know about the dual,
both sides of the paper, it might not know about the CPF filter, you know, things like that.
So, if you went all the bells and whistles, you're going to want to check with the company, see if
they've got Linux drivers, you might want to do that before you go out and buy a printer,
because otherwise, you know, you'll load the company drivers on your Windows box and you'll have
all kinds of functionality and then you'll be using a generic driver from the Linux box and
you're going to notice that some things are not there and that's the reason. So, driver research
is probably not a bad idea before you go buy a printer. If you're like me, you don't really care,
all you want to do is be able to print some text on paper. So, one good resource if you're not
like me is OpenPrinting.org, yeah. Go to OpenPrinting.org, that's a page hosted by the Linux Foundation,
lots of information about drivers, compatibility, you know, the generic drivers versus non-generic,
all that good stuff. So, it's also got a pretty good section on Cups, by the way, but here we are
talking about Cups and we haven't really talked about Cups yet. So, let us talk about Cups.
So, Cups, the easiest way to interface with it, I find, is just directly with the built-in
little interface that they provide you. Like I say, GNOME and KDE, I'm pretty sure have front-ends
for this, but why poke around in a front-end to a front-end when you can just poke around in
the front-end. So, if you want to look at Cups, just open up a browser and go to 127.0.0.1,
which of course is your loop back address, so it's your own computer. So, it's 127.0.0.1,
colon 631. So, you're looking straight down the port, the 631st port of your very own computer
in your browser, and it'll bring up what looks like a little web page, and it'll be a welcome page
at first, and there are a series of tabs up at the top, and one is administration. If you click
on administration, you will find, no, at this point you'll want to have your printer plugged in,
and you will find that it knows that you want to either add a printer, find a new printer,
or manage printers that you've already added in the past. Now, if you've never added a printer yet,
you can click on the find new printers, and it will actually find really most printers that you
have access to, whether it's the one that you just now plugged into your USB port, or whether
it's one sitting off in the living room plugged into your router. It's really pretty diverse,
it's not diverse, it's pretty robust, it's pretty clever that way, and if you do that, if you
just tell it, okay, find new printer, it might ask you to identify what driver you want to use with
that printer, and then you just click on add printer, and next thing you know, you have added a
printer to your system, and Cups is now aware of it, and we'll create a spool for it, and when you
go to print, that will be one of your options, or it might be the only option if that's the only
printer you've got, but that's, it's technically speaking as easy as that. If you just click on find
new printers, it will very frequently auto detect the printers on your network, or your local printers
plugged into your, directly into your computer, and there won't be a whole lot more to do with it.
But let's assume for the moment, because if we didn't, it would be a short episode, let's assume
for a moment that we've got, that we've got something that is not being auto detected, and so I'm
going to print, I'm going to plug this Canon printer in, and I'm going to click on add printer,
and it says, okay, name the printer, so I'm going to, this is a PIXMA, a Canon PIXMA 6220, so I'm
going to call it PIXMA 6220, it wants to know the location of the printer, this is human readable,
so the name of it PIXMA 6220, that, I mean, that is human readable, but it should also be computer
friendly, so don't, you're not going to use spaces, or special characters, or anything like that.
I'm just going to call it PIXMA 6220, very simple. The location that you want to call it something
human readable, this is for your information only, it's just literally where the, where is the
printer? In this case, it's right here on my desk, so I'm just going to put desk, but if it was
maybe out in a living room or something, I might want to put, okay, this is the one in the living room,
and then there's the description, and that again, it's just for your information, so this might,
I might want to put like, this is my Canon photo printer, you know, that I got, say for Christmas,
whatever, make it, you know, as technical or not, as you want. Now it is, you say continue,
and then it asks you, okay, well, what kind of device is this? Your options are going to change,
are going to differ depending on how friendly your printer is, you know. Now in this case,
in my drop down menu, there is a selection right here, Canon IP62220, USB printer, and that's,
that's correct, that is the printer that I want to use, so I'm going to go ahead and select that.
In other cases, you might not get so lucky, and you might have to, you might have to just say, okay,
this is, you know, this is a, this is a printer on my network, so it's, I'm going to use the IPP
protocol, that's what I usually use if it's a network printer, but we'll go over that in a minute,
and then it asks for the make and the manufacturer, so I'm going to select Canon, and then it says,
okay, what driver do you want to use? There's a huge list of thematic drivers that I would never,
I mean, I, the 62220 is not in here, it's a, I guess maybe it's a fairly new printer,
but it gives me a good, a couple of good guesses as to which one to use, it recommends one,
I'm just going to go with the recommendation that they've never been wrong before,
and then it says the printer has been successfully added, and then it gives me an option screen
on various defaults that I can set, like the media, default media size, you know, either US letter,
or like A4, you know, just whatever your default paper size is, media source, you want it from
the tray, or do you want it from the manual feed, two-sided printing, is that, I guess that,
that is an option here, duplexer, not installed or installed, I have no idea what a duplexer is,
banners, policies, what, what to do on an error, should I, if it, if there's an error, should I stop
the printer entirely, and wait for more instruction, or should I abort the job altogether, should I
retry the job, things like that, so you can set printer options there. Now, after you do that,
it should take you, yeah, it takes you to basically your list of printers, I think, either that
or it just takes you to that one printer, but you should see that printer listed, it should be,
you know, I've got PIXMA 6220, the description, Canon Photo Printer that I got for X-MUS,
location, desk, see, this is all the stuff that I entered, printer driver is the Fumatic,
the S400 Fumatic, printer driver, generic, recommended, printer state, is that it's idle,
it's accepting jobs, and it's published, meaning that yes, it is on the network, and everyone is
able to see it, and then the device is listed as how free desktop.org slash big old long thing,
so basically that's just saying that it knows the physical location of it, it's ready to go,
it's got a driver loaded, and to see if I'm actually correct about this, I could hit print test
page, and at that point you would start hearing the printer, gearing up to print the test page,
and you'll also see it, if you click on show all jobs, it will show you that you've just
sent a test page to your printer, and it will show you the status of it. Now, if it says it was
completed and it hasn't actually completed, there's something wrong, and you might want to go
back to administration, and either try to find a new printer, you know, maybe it'll just detect it
on its own, that's the, again, the easier way, or you can go back to the PIXMA 6-T220 modify printer,
and it'll take you through the whole thing again, and maybe you entered the device wrong,
or maybe you chose the wrong driver, or something like that, but very rarely have I had a problem
with any of that, it seems like this kind of stuff, especially if you let it do a lot of the
thinking for you, it just kind of works, it's really cool. So, now let's say that we want to get
a little bit more creative, and we want to, instead of having the USB printer plugged straight
into our computer, maybe we've got some kind of router, with the USB jack in it, or maybe we've got a,
maybe we have a printer with a ethernet port on it, or whatever, and that's fine because what you
can do in that case is use the internet printing protocol, IPP, and this will help you discover your
printer on your network. Now again, if you go to the administration tab, and you just, as long as
your printer is plugged in and turned on, then if you find new printers, chances are it's going to
find that printer for you, and you don't have to really think about it that much, but if not,
you might want to, let's say that you plug your laser printer into your router with the ethernet
cable, you should be able to find the IP address of that printer, either on the printer itself,
not written on it, but like in the menu, in the printer menu, or on your routers,
in your, within your router's information, like the DHCP list, where it's showing what IP address is,
it's handing out, it'll, it should show you that yes, it's got a printer attached with the
IP address of, you know, 192.168.1.11, or whatever, so that would be the IP address of that printer.
So you would say add printer, well first you'd say find printer, and see if it can just find it,
because that would make it really easy. So name, let's call this one, Pixman Net,
location will say, what's actually still on my desk, but let's just pretend like it's in the
other room, let's say that this is in the office, and then description, we'll call this the
Canon Photo Printer on the Net Work, and the device that you want to use for this would be the
internet printing protocol, IPP, and then you say continue. Now it's asking you for the socket,
or the, I guess it's the URI, I don't really know what that stands for, I think it might mean
the uniform resource identifier, pretty slick googling there. So you put IPP, colon slash slash,
and then you know, you can do it by the host name, I just do it by the, you know, by the,
look by the IP address, so there you go, and then you say continue, and then again it asks you,
okay, who made or manufactured this, it's still Canon, the driver can be the exact same, it's the
Fumatic S400, maybe that's 5400, I don't know, but whichever one it just now recommended to me,
that's what I usually use, and then again you've got your set the printing options,
so I can do whatever I need to do there, on the error I'm going to just say abort the job so that
I don't hold up everyone on the network, you know, waiting for my job to complete, and I'll set the
printer options, and again it takes me back to my list of, to that printer as it's been set up,
it shows all the device, it says it's idle, it's accepting jobs, I can print my test page again,
I can modify it, whatever I need to do, set it as the default, you know, just whatever,
now the other tabs at the top of the, of the, of the page here, one is classes,
and one is documentation, and then one is jobs, jobs is obviously where you go to see the active
print jobs in, you know, in the, in the spool, in the queue, and then classes is basically,
if you want, if you have a cluster of, you know, if you have a print center, you can add the
IP address of, for instance, a print server to, to the classes, and then you can, you know, instead
of just identifying a single printer, you can identify the class, I have never used that,
so I couldn't really tell you much about it, if you're setting up a print center, you'll probably
want to do a lot more research than just listening to my Hacker Public Radio episode on it,
unfortunately, I'm not that much of a printing geek, but for sure, Cups is a very powerful way
to get your printers identified to your computer, and kind of route it around, you know, your network,
so that you've got access to all the, all the printers on your network, and like I say,
this is one of the most direct ways of doing that, at least in my opinion, is just going straight
to, you know, localhost colon 631, and, and just setting it up all in here, and it's really
cool because no matter what system you're on, you can open up a browser, conquer our Firefox,
Safari, you know, whatever browser you've got on that Unix or Unix like system,
open it up, go to localhost colon 631, there's all your printer lists, you have full access to
all the drivers that are installed, and you've got, you can manage the jobs, you can kill jobs,
you can add jobs, you can modify the printers, whatever, it doesn't, it doesn't really,
you know, it's just a very direct way of, of managing the, the printers around your, your network.
If you're not sure of where your printer is located, you know, like I say, usually investigating
in the, in within the router to see if it's distributing an IP address helps, or possibly like,
if you've got, if you're doing a, the print server kind of set up, well, you'll probably know
if you're doing a print server set up, so really the, the, the biggest variable I think is
just knowing, knowing the physical location of the printer, so if it's IPP, it's, it's an
IP address, if it's USB, there's usually a selection for USB, it's generally speaking,
something that Hal is doing, it's an automatic detection kind of thing, so that's usually what
it is. Yeah, I've never really had a problem identifying the location of the printer actually,
just let cups do the work for you. It's, they, they, they give you the option of letting it find
the printer for you for a reason, because it really, really does work pretty well. So, give
that a shot, you can use cups to also turn your, turn your computer, you know, sort of into a print
server, which, you know, again, I, I don't really know a whole lot about that kind of stuff,
so I'm going to leave that to either someone else or to you to explore, but it's a really cool
system. It works remarkably well. Very frequently, I find myself using cups as opposed to whatever
other solution, you know, some printing company or computer company claims to have to, to give you,
you know, basically the same functionality that, that cups will give you. So definitely, check
it out, give familiar with it, it's a really handy kind of universal thing to know, and it's,
it really works, it works really well.
Oh, and keep in mind, please, that Hacker Public Radio is always looking for new hosts and
looking for new episodes, really. Hacker Public Radio is a great way to get out some podcasting
energy without the commitment, you know, so have a one night stand with Hacker Public Radio. It's,
it's really, it's, it's a good thing to do, honestly. So, you know, throw us an episode,
you've probably got some knowledge that someone else doesn't have, so record that knowledge,
send it to us, we'll slap some music on it, and play it, and people will love it. So bring it on.
Thank you for listening to Hacker Public Radio.
HPR is sponsored by caro.net, so head on over to C-A-R-O-DOT-N-C for all of those of you.
Thank you for listening to Hacker Public Radio. HPR is sponsored by caro.net, so head on over to C-A-R-O-DOT-N-C for all of those of you.
Hacker Public Radio is sponsored by caro.net, so head on over to C-A-R-O-DOT-N-C for all of those of you.
Hacker Public Radio is sponsored by caro.net, so head on over to C-A-R-O-DOT-N-C for all of those of you.