236 lines
17 KiB
Plaintext
236 lines
17 KiB
Plaintext
|
|
Episode: 1864
|
||
|
|
Title: HPR1864: Turning an old printer into a network printer
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1864/hpr1864.mp3
|
||
|
|
Transcribed: 2025-10-18 10:23:18
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
This is HPR Episode 1864 entitled Turning an Old printer into a network printer.
|
||
|
|
It is hosted by Dave Morris and is about 21 minutes long.
|
||
|
|
The summary is using a Raspberry Pi and a Print Boomer for an old USB printer.
|
||
|
|
This episode of HPR is brought to you by AnanasThost.com.
|
||
|
|
Get 15% discount on all shared hosting with the offer code HPR15.
|
||
|
|
That's HPR15.
|
||
|
|
Better web hosting that's honest and fair at AnanasThost.com.
|
||
|
|
Hello everyone, my name is Dave Morris here in Edinburgh.
|
||
|
|
Today I've got a talk for you about some stuff I've been doing over the past few months.
|
||
|
|
I've entitled it Turning an Old printer into a network printer.
|
||
|
|
I bought a USB printer back in 2005 when I bought a family PC, a Windows PC.
|
||
|
|
It's an HP printer. It's an inkjet. It's called a Photosmart2410.
|
||
|
|
It's one of these things that's got a scanner in it.
|
||
|
|
It can do faxes. I don't think I've ever used that feature.
|
||
|
|
It can read various types of cards but not any of the new styler.
|
||
|
|
Yeah, it did a range of cards. Anyway, it's not been used.
|
||
|
|
I've stopped using the Windows PC for many years now.
|
||
|
|
It's only a Pentium 4 and nobody particularly wanted Windows XP and stuff.
|
||
|
|
So the printer has been left gathering dust in a corner for a long time.
|
||
|
|
Recently I thought it would be useful to maybe see if I could wake it up, bring it back to life again.
|
||
|
|
So I gave it a good clean up and bought some new ink cartridges for it.
|
||
|
|
This HP printer, being an HP printer, is well catered for under Linux.
|
||
|
|
And it's not a difficult matter to plug it into a Linux box and install cups and use the same interface.
|
||
|
|
Cups are printing same for scanning and you can bring it back to life again but I didn't really want to do that.
|
||
|
|
What I wanted to do is to turn it into a network printer that could be used by the rest of the family.
|
||
|
|
My kids are mostly away at university these days but invariably they've got something they want to print when they pass through.
|
||
|
|
So I thought this would be a good solution to that problem.
|
||
|
|
At least when they don't need very high quality stuff, I have a colour laser jet as well.
|
||
|
|
But I tend not to run that quite much because it's quite expensive to run.
|
||
|
|
So I searched the internet and found an article which I've linked to in a magazine called Raspberry Pi Geek.
|
||
|
|
And I've been using that as the basis of my investigations to set things up.
|
||
|
|
So you'll gather from that what I'm doing is using the Raspberry Pi.
|
||
|
|
I've got an old one which I bought back when they first came out.
|
||
|
|
It's a model B, the sort that had two USBs on it.
|
||
|
|
I think it was about 2012 that I bought it.
|
||
|
|
Certainly I remember putting in my pre-order before they were even available and getting it.
|
||
|
|
But it's not been used a huge lot.
|
||
|
|
It's in one of the Pimironi acrylic rainbow cases which I really like because you build them.
|
||
|
|
Stack bits on top of the other.
|
||
|
|
There's quite some useful variations on the original case.
|
||
|
|
So what I've done is I've got the Pi and I've connected it directly to my router with an ethernet cable.
|
||
|
|
It actually sits where the timer wrote this up.
|
||
|
|
I've been working on these notes for a while.
|
||
|
|
I first put it up.
|
||
|
|
It was on a shelf that I had in the corner of the living room with the router and the Pi sat on there nicely.
|
||
|
|
I've since rearranged things a little bit and it's on a shelving system that I bought from my kea.
|
||
|
|
Anyway, it's the printer is underneath the shelf.
|
||
|
|
It can easily be connected to the Pi with the USB cable.
|
||
|
|
The printer needs a fair bit of space so you can open the lid.
|
||
|
|
You can open the scanner tray and you can open the lid to get to the ink and stuff.
|
||
|
|
It also needs room for the paper tray.
|
||
|
|
So you need something fairly substantial to sit on.
|
||
|
|
The Pi is running Razbian and it's off 32GB SD card at class 10 which is overkill probably for this.
|
||
|
|
But it's what I had.
|
||
|
|
Before I started this project, I made sure I had the latest version of Razbian on it.
|
||
|
|
As an aside, because the power supply for this printer seems to consume power even when the printer is off.
|
||
|
|
It's not physically switched off.
|
||
|
|
It's just a software control.
|
||
|
|
I installed one of the radio control switches I use in the house and I turned it on and off with a remote control.
|
||
|
|
So, I think I bought a set of four of these things.
|
||
|
|
I've linked to it in case you're interested.
|
||
|
|
And I use them for various bits of kit around the house to power them on and off from the mains.
|
||
|
|
The turning on of this printer, which wakes it up, makes it go through self tests and stuff,
|
||
|
|
is something that totally and utterly fascinates my cat.
|
||
|
|
And I included a picture of her running across to the printer and sitting there staring.
|
||
|
|
I had it waiting for something or other to happen.
|
||
|
|
I'm not sure what she thinks is going on.
|
||
|
|
Something lives in there probably in her mind.
|
||
|
|
So when I was setting things up, I configured the pie connected to a monitor keyboard and mouse.
|
||
|
|
And then I put SSH on it and placed it where in its final location where it's just running headless.
|
||
|
|
So I can SSH into it.
|
||
|
|
I normally assign all of my local machines a fixed DHCP address on the router.
|
||
|
|
And then I add this address to etc hosts on all of my client machines.
|
||
|
|
This one ended up being called RPI-1.
|
||
|
|
And it's got an address of all my devices in the 192168.0 range.
|
||
|
|
And this is 66.
|
||
|
|
So in the headless mode, I installed cups.
|
||
|
|
It's pretty simple.
|
||
|
|
On Raspberry and this brings in many other packages such as the HP LIP, HP Linux Imaging and Printing.
|
||
|
|
And same, which I'm fascinated to learn stands for scanner access now easy.
|
||
|
|
Cheesy or what? Wow.
|
||
|
|
It also brings in many filters and printer drivers.
|
||
|
|
So cups is really cool.
|
||
|
|
I know other people have spoken about it and gone in a fair bit of depth.
|
||
|
|
But I still thought this would be of interest.
|
||
|
|
People wanting to do the same as I've been doing.
|
||
|
|
So once cups is installed, it's fairly simple to configure it either through the HP Setup tool or the web interface.
|
||
|
|
Now, HP Setup is primarily used for setting up HP printers, which interface to the HP LIP software.
|
||
|
|
And since I was setting up an HP printer, I used the command HP hyphen setup space minus i for this.
|
||
|
|
And used it to configure a print queue with the HP Cups driver.
|
||
|
|
If you are doing this with a different sort of printer, then you might be best used the Cups web interface.
|
||
|
|
But I don't have any direct experience of this for other printers.
|
||
|
|
The web interface to Cups is quite good.
|
||
|
|
It's available on port 631.
|
||
|
|
So I simply point a browser to my Raspberry Pi with an O with an HTTP colon slash slash address.
|
||
|
|
66 colon, 631.
|
||
|
|
I'll read it all out in detail.
|
||
|
|
And there you go.
|
||
|
|
I have access to the interface.
|
||
|
|
And there's administrative functions such as managing printers and print jobs.
|
||
|
|
You need to authenticate the Cups and to use credentials which have the ability to perform printer administration.
|
||
|
|
So I chose to give my account on the Raspberry Pi, which is Dave, LP admin rights.
|
||
|
|
And that's simply done with a user mod command, which I've put in the notes.
|
||
|
|
I'll read it out.
|
||
|
|
pseudo space user mod space hyphen A, space hyphen capital G, space LP admin space Dave.
|
||
|
|
So what that's doing is adding to the user account Dave, the group LP admin.
|
||
|
|
If you look in the Raspberry Pi Geek magazine article, it recommends some further steps steps to make the printer visible.
|
||
|
|
And this is using the Cups interface.
|
||
|
|
So you put in, you type in the command pseudo space Cups Ctl,
|
||
|
|
in large case space hyphen hyphen remote space any.
|
||
|
|
I think that says any address can access the printer.
|
||
|
|
And you also need to change a file.
|
||
|
|
No, you don't.
|
||
|
|
You also need to restart the Cups service, which they recommend using the init.d startup file.
|
||
|
|
But I actually used the Raspbian service command, which is a Debian thing, pseudo space service space Cups space restart.
|
||
|
|
So then using the web interface, I could create Cups printer cues on the Raspberry Pi.
|
||
|
|
I saved cues in the plural because I tried messing around with with cues with different behaviors.
|
||
|
|
I don't think that was really necessary.
|
||
|
|
I haven't gone into detail of what I did there.
|
||
|
|
So in the magazine article I referred to, there's advice on setting up print lines on remote systems.
|
||
|
|
I did this on my Debian testing KDE system by invoking system settings and selecting the printer's entry.
|
||
|
|
So you can just define a printer that way and point it at the remote printer.
|
||
|
|
My son who was around at the time and has a MacBook did pretty much the same in order to print.
|
||
|
|
Given that Cups is now an Apple product and is available on OSX, it's not too surprising.
|
||
|
|
He could do that easily.
|
||
|
|
I did have a look at getting my Android phone or Nexus 7 tablet to print.
|
||
|
|
They can both print to my networked HP LaserJet printer, but there's a plugin called HP Print Service,
|
||
|
|
a free one that allows that.
|
||
|
|
And I don't think this uses a standard LPR type of connection.
|
||
|
|
I'm not prepared to pay money to make one of these devices print.
|
||
|
|
And I've only found non-free Android apps so far to do this.
|
||
|
|
It's not really a big deal.
|
||
|
|
I have never wanted to print other than to prove that I could.
|
||
|
|
At the time of writing, which is now, I've not managed to set up my daughter's Windows 8 PC to use this printer.
|
||
|
|
I was aware that I could set up Sambo on the Raspberry Pi, which could then be made visible to Windows boxes.
|
||
|
|
But I was a bit reluctant to do this.
|
||
|
|
I didn't really want to have Sambo floating about now.
|
||
|
|
My daughter's actually away at university now, but I recently found some helpful advice on this subject on the Arch Wiki.
|
||
|
|
In particular, the use of IPP, which is Internet Printing Protocol, which is an HTTP interface to CUPS.
|
||
|
|
So I've not tested this because I don't have a Windows machine available at the moment.
|
||
|
|
But when I do, when one of the kids comes by, I've got Windows, I will set that up and test it.
|
||
|
|
The advice on the Arch Wiki, I was fascinated to see, does not recommend the use of Sambo, which get on board with totally.
|
||
|
|
So I've put the sort of URL that I would use when I come to test this in the long notes, by the way,
|
||
|
|
which is the, which references the server, port 631, and then the name of the queue.
|
||
|
|
So hopefully that will solve that particular problem.
|
||
|
|
So this printer, as I mentioned before, also has a scanner incorporated into it.
|
||
|
|
So I reckon that it should be possible to operate the scanner remotely.
|
||
|
|
According to them, Raspberry Pi Geek magazine, you can do this by making sure the same demon runs all the time.
|
||
|
|
And in order to do this, you have to edit the file slash ETC slash default slash same D.
|
||
|
|
As I've put in the notes, I added two lines to this file, which are,
|
||
|
|
IUN, capital IUN equals yes, lowercase yes, run equals yes, that is.
|
||
|
|
And run as user, that's capital IUN, underscore capital AS, underscore capital USCR,
|
||
|
|
equals same D in lowercase S, A, N, E, D.
|
||
|
|
So I think that means run it all the time and the user's run under is user same D.
|
||
|
|
It was recommended to edit slash ETC slash sane S, A, N, D, dot D slash S, A, N, E, D, dot conf,
|
||
|
|
et cetera, sane D, sane D dot conf, to add the line.
|
||
|
|
And in my case, this was the range of addresses on my local network, local network is 192.168.0.0.
|
||
|
|
And if you add a slash 24 on the end of that, it means everything from 0 to 255,
|
||
|
|
that last digit varies from 0 to 255.
|
||
|
|
So everything that's being served locally by my router, which only covers that range anyway,
|
||
|
|
is available to, is capable of accessing the scanner.
|
||
|
|
That was intention.
|
||
|
|
Then I started the demon on the Raspberry Pi with pseudo space service space sane D,
|
||
|
|
as I said, A, N, E, D space restart to the service and the user are the same.
|
||
|
|
And then on the Pi, I tried the following command, which is, these are all in the notes,
|
||
|
|
of course, pseudo space scan image, S, C, A, N, I, M, A, G, E, lowercase all the way through,
|
||
|
|
space minus capital L. I think what that's doing is it's looking for all visible scanner devices
|
||
|
|
on the network. I think I'm not looked into that in great detail, but I think that's what it's
|
||
|
|
doing. And I get back, I got back a response, which is long so I won't read it,
|
||
|
|
which begins with device, followed by various details of the device and some text that says
|
||
|
|
that it's a Hewlett-Packard PSC 2400 series, blah blah blah. So the scanner's visible from the
|
||
|
|
Raspberry Pi. So next I moved to my desktop machine, which also had cups installed, which is
|
||
|
|
necessary prerequisite, and used the same command, but didn't find the scanner. So I went back to
|
||
|
|
the Raspberry Pi and looked at one of the logs, which is slash, vah slash log slash demon.log.
|
||
|
|
And in it, I saw the Linux desktop machine connecting, it's on 191.68.0.5,
|
||
|
|
saw it being granted access, and then I got a permission denied message invalid USB
|
||
|
|
underscore open permission denied. So some things not right on the Raspberry Pi in terms of
|
||
|
|
permissions, it seems. Took me a while to work out what was happening, but to cut a long story short,
|
||
|
|
I first of all found the device and you do that as root on the Pi by typing ls usb and various
|
||
|
|
devices to listen, including the usb infrastructure itself, but the last one I saw was the printer.
|
||
|
|
And it came back as being on bus 001 device 009. I then did an ls minus l on that device,
|
||
|
|
which is actually slash dev slash bus slash usb slash 001 slash 009. And what I see saw,
|
||
|
|
what you can see yourself in my notes. And it was much, was it much that I did this? Anyway,
|
||
|
|
for a while ago, is that it's owned by user root group LP. It does not entirely, you know,
|
||
|
|
it makes sense. It's not stupid to talk, because it's it's a printer. So group LP seems like
|
||
|
|
a reasonable thing to make it owned by. But looking at user sain d to see which groups it's in,
|
||
|
|
and that use the ID command for that ID space sain d, you get back, it's your ID, it's GID,
|
||
|
|
and then a list of its groups. It's in the group sain d, which is normal, that things belong to
|
||
|
|
their own, a group named the same as the user name. And it's in the group scanner, which is 1100.
|
||
|
|
So that's why user sain d can't access the device. It doesn't have, it's not in the same group,
|
||
|
|
it's not in the right group. Now various things you could do to fix this. But given that a device
|
||
|
|
can only be in one group without going to jump through a lot of hoops, then the simplest thing
|
||
|
|
to do seemed to be to add user sain d to the LP group. So that was done with the user mod command,
|
||
|
|
I'm root when I'm doing this. And it's the same sort of command that we saw earlier, user mod
|
||
|
|
space minus low case A, space minus capital G, space LP, space sain d. So user mod ad group LP
|
||
|
|
to sain d is what that's doing. Then ID, sain d gives back the extended group, which is
|
||
|
|
sain d is before LP and scanner. So that's achieved what we wanted to do in terms of groups. Now
|
||
|
|
scan image minus L from the capital L again, from the remote client, returned the device message
|
||
|
|
saying yes, I see an HP printer. So having done that, it was possible for the remote system
|
||
|
|
to access the scanner with Gimp. Gimp has a scanner interface. There's a tool called xsain, capital
|
||
|
|
X, sain e, lower case. And there are various other same tools that would let you get access to
|
||
|
|
scanners. It's not clear why standard cups create the user sain d in the scanner group,
|
||
|
|
where the device is owned by the LP group, some sort of logic snafu going on there. There's a
|
||
|
|
certain element of sensing there that the device is owned by LP, but it also ought to be owned by
|
||
|
|
scanner. Anyway, I'm not sure if this is a problem with the sain d user itself, or maybe there's
|
||
|
|
something that the UDev code should be doing when it creates the device. I could mess around with
|
||
|
|
this. I haven't done so. If you're interested in looking at this type of thing yourself, Klaatu has
|
||
|
|
done some excellent shows on building your own UDev rules on his podcast Gnu World Order.
|
||
|
|
In terms of accessing the scanner from macOS X and from windows, I haven't tested these yet.
|
||
|
|
Nobody's really wanted to do much in the way of scanning from these devices. The old occasion
|
||
|
|
when they have somebody visited and said, I've got this document, can you scan it? The easiest
|
||
|
|
thing to do is just scan it onto my Linux box and then share it with them, or indeed print it
|
||
|
|
if they wanted a copy. The print is actually able to do copies all by itself, so it's not
|
||
|
|
usual, that's what they want, but they're often like electronic versions, so I just email it to them
|
||
|
|
or share our drop box or something like that. But this is something I would like to look into
|
||
|
|
in the future, but I don't have either of these machines to play with, so I need to wait for
|
||
|
|
suitable visitors to come along and help me to test it out. So that's it. I hopefully you
|
||
|
|
found it useful if you're thinking of going down this sort of road yourself or you've had problems
|
||
|
|
solving similar sort of problems to the ones I was looking at. I hope you found it useful anyway.
|
||
|
|
Okay, bye.
|
||
|
|
You've been listening to Hecker Public Radio at Hecker Public Radio. We are a community podcast
|
||
|
|
network that releases shows every weekday Monday through Friday. Today's show, like all our
|
||
|
|
shows, was contributed by an HPR listener like yourself. If you ever thought of recording a
|
||
|
|
podcast and click on our contributing to find out how easy it really is. Hecker Public Radio was
|
||
|
|
founded by the digital dog pound and the infonomicon computer club, and it's part of the binary
|
||
|
|
revolution at binwreff.com. If you have comments on today's show, please email the host directly,
|
||
|
|
leave a comment on the website, or record a follow-up episode yourself. Unless otherwise status,
|
||
|
|
today's show is released under Creative Commons, Attribution, ShareLite, 3.0 license.
|