142 lines
14 KiB
HTML
142 lines
14 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<meta charset="utf-8">
|
||
|
|
<meta name="generator" content="pandoc">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
|
|
<meta name="author" content="Dave Morriss">
|
||
|
|
<title>Turning an old printer into a network printer (HPR Show 1864)</title>
|
||
|
|
<style type="text/css">code{white-space: pre;}</style>
|
||
|
|
<!--[if lt IE 9]>
|
||
|
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||
|
|
<![endif]-->
|
||
|
|
<link rel="stylesheet" href="http://hackerpublicradio.org/css/hpr.css">
|
||
|
|
</head>
|
||
|
|
|
||
|
|
<body id="home">
|
||
|
|
<div id="container" class="shadow">
|
||
|
|
<header>
|
||
|
|
<h1 class="title">Turning an old printer into a network printer (HPR Show 1864)</h1>
|
||
|
|
<h2 class="author">Dave Morriss</h2>
|
||
|
|
<hr/>
|
||
|
|
</header>
|
||
|
|
|
||
|
|
<main id="maincontent">
|
||
|
|
<article>
|
||
|
|
<header>
|
||
|
|
<h1>Table of Contents</h1>
|
||
|
|
<nav id="TOC">
|
||
|
|
<ul>
|
||
|
|
<li><a href="#introduction">Introduction</a></li>
|
||
|
|
<li><a href="#using-a-raspberry-pi">Using a Raspberry Pi</a></li>
|
||
|
|
<li><a href="#cups">CUPS</a><ul>
|
||
|
|
<li><a href="#cups-web-interface">CUPS Web Interface</a></li>
|
||
|
|
<li><a href="#accessing-the-printer">Accessing the printer</a></li>
|
||
|
|
</ul></li>
|
||
|
|
<li><a href="#sane">SANE</a><ul>
|
||
|
|
<li><a href="#accessing-the-scanner-from-mac-osx-and-windows">Accessing the scanner from Mac OSX and Windows</a></li>
|
||
|
|
</ul></li>
|
||
|
|
<li><a href="#links">Links</a></li>
|
||
|
|
</ul>
|
||
|
|
</nav>
|
||
|
|
</header>
|
||
|
|
<h2 id="introduction">Introduction</h2>
|
||
|
|
<p>I have a USB printer I bought back in 2005 when I bought a Windows PC for the family. It's an <a href="http://h10025.www1.hp.com/ewfrf/wc/product?cc=uk&lc=en&product=303753">HP PSC 2410 PhotoSmart All-in-One printer</a>. This device is a colour inkjet printer, with a scanner, FAX and card-reading facilities. It has been left unused in a corner for many years, and I recently decided to to see if I could make use of it again, so I cleaned it up and bought some new ink cartridges for it.</p>
|
||
|
|
<p>This printer is well catered for under Linux and it is possible to access it using <a href="https://www.cups.org/" title="CUPS">CUPS</a> for the printing and <a href="http://en.wikipedia.org/wiki/Scanner_Access_Now_Easy" title="SANE">SANE</a> for scanning. I connected it to my Linux desktop for a while to prove that it was usable. However, rather than leaving it connected in this way, I wanted 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 need to print stuff when they pass through. I searched the Internet and found an <a href="http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server" title="Raspberry Pi Geek">article</a> in the <em>Raspberry Pi Geek</em> magazine which helped with this project.</p>
|
||
|
|
<h2 id="using-a-raspberry-pi">Using a Raspberry Pi</h2>
|
||
|
|
<p>I decided to use my oldest Raspberry Pi to run this printer. I have a 2 USB port Model B that I bought when these devices first came out in 2012, and I haven't used it much. It's in one of the early <a href="http://pimoroni.com/" title="Pimoroni">Pimoroni</a> <em>Pibow</em> acrylic rainbow cases.</p>
|
||
|
|
<p>I connected the Pi directly to my router with an ethernet cable. The router is on a shelf I put up in the corner of my living room and the Pi fits on there quite comfortably.</p>
|
||
|
|
<p>The printer is on a small table in the corner of the room under the router shelf. It's connected to the Pi with a USB cable. It needs a reasonable amount of space, mainly for the paper tray and the output tray at the front. It also needs room to be able to open the lid of the scanner for scanning and copying purposes.</p>
|
||
|
|
<p>The Pi is running Raspbian off a class 10 32Gb SD card. This is overkill for this function, but I already had the card. I made sure I had the latest Raspbian release on this card.</p>
|
||
|
|
<p>Because the power supply for the printer seems to consume power even when the printer is off I installed one of the <a href="http://www.amazon.co.uk/Brennenstuhl-Energy-Efficient-Control-Receivers-White/dp/B003BIFLSY/ref=pd_sim_ce_1?ie=UTF8&refRID=1KZJS5QT3ZDK1BJCN5AE" title="Remote-controlled switch">radio-controlled switches</a> I use in the house and turn it on and off with a remote control. The turning on and all of the activities of this printer are a matter of extreme fascination for my cat.</p>
|
||
|
|
<p><img src="hpr1864_printer_monitor.png" alt="Cat monitor" /><br />Picture: cat > printer</p>
|
||
|
|
<h2 id="cups">CUPS</h2>
|
||
|
|
<p>I configured the Pi while it was connected to a monitor, keyboard and mouse, enabled SSH on it and put it in its final location, running headless. I normally assign all of my local machines a fixed DHCP address on the router and add this address to <code>/etc/hosts</code> on all of my client machines. This one ended up being called <code>rpi1</code> with the address <code>192.168.0.66</code>.</p>
|
||
|
|
<p>In the headless mode I installed <a href="https://www.cups.org/" title="CUPS">CUPS</a>. On Raspbian this brings in many other packages such as HP Linux Imaging and Printing (<a href="http://hplipopensource.com/hplip-web/index.html" title="HPLIP">HPLIP</a>), <em>Scanner Access Now Easy</em> (<a href="http://en.wikipedia.org/wiki/Scanner_Access_Now_Easy" title="SANE">SANE</a>) and many filters and printer drivers.</p>
|
||
|
|
<p>Once CUPS is installed it is fairly simple to configure it either through the <code>hp-setup</code> tool or the web interface. As you might have guessed, <code>hp-setup</code> is primarily used for setting up HP printers which interface to the HPLIP software. Since I was setting up an HP printer I used the command <code>hp-setup -i</code> for this and used it to configure a print queue with the <code>hpcups</code> driver.</p>
|
||
|
|
<h3 id="cups-web-interface">CUPS Web Interface</h3>
|
||
|
|
<p>If you are doing this you might prefer to use the web interface to CUPS, especially if you are using a non-HP printer. The interface is available on port 631, so in my case I simply point a browser to my Raspberry Pi with the following URL <strong>http://192.168.0.66:631/</strong></p>
|
||
|
|
<p>In order to be able to perform administrative functions such as managing printers and print jobs, it is necessary to authenticate to CUPS and to use credentials which have the ability to perform printer administration.</p>
|
||
|
|
<p>I chose to give my account "<code>dave</code>" on the Raspberry Pi <code>lpadmin</code> rights:</p>
|
||
|
|
<pre><code>sudo usermod -a -G lpadmin dave</code></pre>
|
||
|
|
<p>The Raspberry Pi Geek magazine <a href="http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server" title="Raspberry Pi Geek">article</a> recommends the following steps to make the printer visible from any address:</p>
|
||
|
|
<pre><code>sudo cupsctl --remote-any
|
||
|
|
sudo /etc/init.d/cups restart</code></pre>
|
||
|
|
<p>I actually used the following to restart CUPS:</p>
|
||
|
|
<pre><code>sudo service cups restart</code></pre>
|
||
|
|
<p>Using the web interface I was able to create CUPS printer queues on the Raspberry Pi.</p>
|
||
|
|
<h3 id="accessing-the-printer">Accessing the printer</h3>
|
||
|
|
<p>The Raspberry Pi Geek magazine <a href="http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server" title="Raspberry Pi Geek">article</a> gives advice on setting up print clients on remote systems. I did this on my Debian Testing KDE system by invoking <em>Systems Settings</em> and selecting the <em>Printers</em> entry. My son did the equivalent on his MacBook in order to print.</p>
|
||
|
|
<p>I have not yet managed to get my Android phone or Nexus 7 tablet to print this way, though they can both print to my networked HP LaserJet printer via the free <em>HP Print Service</em> plugin. I assume this does not use a standard LPR interface. I am not prepared to pay money to make a Unix device print and I have only found non-free Android apps so far.</p>
|
||
|
|
<p>At the time of writing I have not managed to set up my daughter's Windows 8 PC to use this printer. I realised that I could set up <em>SAMBA</em> on the Raspberry Pi, but was reluctant to do so.</p>
|
||
|
|
<p>My daughter is away at university now, but I recently found some helpful advice on this subject on the <a href="https://wiki.archlinux.org/index.php/CUPS_printer_sharing#Linux_server_-_Windows_client" title="CUPS - Linux Server Windows Client">Arch Wiki</a>. In particular, the use of <a href="https://en.wikipedia.org/wiki/Internet_Printing_Protocol" title="IPP">IPP</a> (Internet Printing Protocol) seems to be the best route. Interestingly the advice is <strong>not</strong> to use SAMBA, which appeals to me!</p>
|
||
|
|
<p>It looks as if we can simply add a printer with the address:</p>
|
||
|
|
<pre><code>http://192.168.0.66:631/printers/HP_psc_2400_series</code></pre>
|
||
|
|
<h2 id="sane">SANE</h2>
|
||
|
|
<p>Using the scanner on the remote printer should be straightforward, but I encountered some problems with this.</p>
|
||
|
|
<p>According to the Raspberry Pi Geek magazine <a href="http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server" title="Raspberry Pi Geek">article</a> it is necessary to make the SANE daemon run all the time by editing the file <code>/etc/default/saned</code>. I ensured mine contained the following:</p>
|
||
|
|
<pre><code>RUN=yes
|
||
|
|
RUN_AS_USER=saned</code></pre>
|
||
|
|
<p>I also edited <code>/etc/sane.d/saned.conf</code> and added the line:</p>
|
||
|
|
<pre><code>192.168.0.0/24</code></pre>
|
||
|
|
<p>since all of my local network is in the range 192.168.0.0-192.168.0.255, and this allows access from everything in this range. I then started the daemon with:</p>
|
||
|
|
<pre><code>sudo service saned restart</code></pre>
|
||
|
|
<p>I then tried the following command on the Pi:</p>
|
||
|
|
<pre><code>sudo scanimage -L</code></pre>
|
||
|
|
<p>and saw the following response:</p>
|
||
|
|
<pre><code>device `hpaio:/usb/psc_2400_series?serial=MY47KM22Y36T' is a Hewlett-Packard psc_2400_series all-in-one</code></pre>
|
||
|
|
<p>Moving to my desktop system, which had CUPS installed, the same command did not find the scanner.</p>
|
||
|
|
<p>Examining <code>/var/log/daemon.log</code> on the Pi, I saw:</p>
|
||
|
|
<pre><code>Feb 21 17:14:25 rpi1 saned[3432]: check_host: access by remote host: 192.168.0.5
|
||
|
|
Feb 21 17:14:25 rpi1 saned[3432]: init: access granted to cendjm@192.168.0.5
|
||
|
|
Feb 21 17:14:28 rpi1 saned[3432]: io/hpmud/musb.c 2066: Invalid usb_open: Permission denied
|
||
|
|
Feb 21 17:14:28 rpi1 saned[3432]: quit: exiting</code></pre>
|
||
|
|
<p>It took me a little while to work out what was happening here. To cut a long story short, I found the device and looked at the permissions on it:</p>
|
||
|
|
<pre><code>root@rpi1:~# lsusb
|
||
|
|
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
|
||
|
|
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
||
|
|
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
|
||
|
|
Bus 001 Device 009: ID 03f0:3611 Hewlett-Packard PSC 2410 PhotoSmart
|
||
|
|
|
||
|
|
root@rpi1:~# ls -l /dev/bus/usb/001/009
|
||
|
|
crw-rw-r-T 1 root lp 189, 8 Mar 1 17:17 /dev/bus/usb/001/009</code></pre>
|
||
|
|
<p>The USB device is owned by root and the group lp. However, the user <code>saned</code> has the following groups:</p>
|
||
|
|
<pre><code>root@rpi1:~# id saned
|
||
|
|
uid=110(saned) gid=114(saned) groups=114(saned),110(scanner)</code></pre>
|
||
|
|
<p>So user <code>saned</code> cannot access the device.</p>
|
||
|
|
<p>It seemed that the simplest solution was to add <code>saned</code> to the <code>lp</code> group:</p>
|
||
|
|
<pre><code>root@rpi1:~# usermod -a -G lp saned
|
||
|
|
root@rpi1:~# id saned
|
||
|
|
uid=110(saned) gid=114(saned) groups=114(saned),7(lp),110(scanner)</code></pre>
|
||
|
|
<p>Now <code>scanimage -L</code> from the remote client returned:</p>
|
||
|
|
<pre><code>root@i7-desktop:~# scanimage -L
|
||
|
|
device `net:192.168.0.66:hpaio:/usb/psc_2400_series?serial=MY47KM22Y36T' is a Hewlett-Packard psc_2400_series all-in-one</code></pre>
|
||
|
|
<p>Now it is possible for a remote system to access the scanner through <em>GIMP</em>, <em>Xsane</em> and other SANE interfaces.</p>
|
||
|
|
<p>It is not clear why the standard CUPS installation creates user <code>saned</code> in the <code>scanner</code> group where the device is owned by the <code>lp</code> group. I have not determined if this is a problem with the <code>saned</code> user or the UDEV code that creates the device.</p>
|
||
|
|
<h3 id="accessing-the-scanner-from-mac-osx-and-windows">Accessing the scanner from Mac OSX and Windows</h3>
|
||
|
|
<p>I have not yet managed to test these options. When a scan is required I run it on a Linux system and email it or share it via DropBox.</p>
|
||
|
|
<p>This is obviously an area for future development!</p>
|
||
|
|
<h2 id="links">Links</h2>
|
||
|
|
<ol>
|
||
|
|
<li>HP PSC 2410 PhotoSmart All-in-One printer: <a href="http://h10025.www1.hp.com/ewfrf/wc/product?cc=uk&lc=en&product=303753" class="uri">http://h10025.www1.hp.com/ewfrf/wc/product?cc=uk&lc=en&product=303753</a></li>
|
||
|
|
<li><code>CUPS.org</code> main web site: <a href="https://www.cups.org/" class="uri">https://www.cups.org/</a></li>
|
||
|
|
<li>CUPS Wikipedia entry: <a href="http://en.wikipedia.org/wiki/CUPS" class="uri">http://en.wikipedia.org/wiki/CUPS</a></li>
|
||
|
|
<li>HP Linux Imaging and Printing (HPLIP): <a href="http://hplipopensource.com/hplip-web/index.html" class="uri">http://hplipopensource.com/hplip-web/index.html</a></li>
|
||
|
|
<li><em>Scanner Access Now Easy</em> (SANE): <a href="http://en.wikipedia.org/wiki/Scanner_Access_Now_Easy" class="uri">http://en.wikipedia.org/wiki/Scanner_Access_Now_Easy</a></li>
|
||
|
|
<li>"<em>Converting the Raspberry Pi to a wireless print server</em>" from the Raspberry Pi Geek magazine: <a href="http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server" class="uri">http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server</a></li>
|
||
|
|
<li>Linux Foundation <em>OpenPrinting</em> work group: <a href="http://www.linuxfoundation.org/collaborate/workgroups/openprinting/" class="uri">http://www.linuxfoundation.org/collaborate/workgroups/openprinting/</a>
|
||
|
|
<ul>
|
||
|
|
<li>HP PSC 2400 series details: <a href="http://www.openprinting.org/printer/HP/HP-PSC_2400" class="uri">http://www.openprinting.org/printer/HP/HP-PSC_2400</a></li>
|
||
|
|
</ul></li>
|
||
|
|
<li>Arch Wiki on CUPS - Linux Server Windows Client: <a href="https://wiki.archlinux.org/index.php/CUPS_printer_sharing#Linux_server_-_Windows_client" class="uri">https://wiki.archlinux.org/index.php/CUPS_printer_sharing#Linux_server_-_Windows_client</a></li>
|
||
|
|
<li>Internet Printing Protocol (IPP): <a href="https://en.wikipedia.org/wiki/Internet_Printing_Protocol" class="uri">https://en.wikipedia.org/wiki/Internet_Printing_Protocol</a></li>
|
||
|
|
</ol>
|
||
|
|
<!--
|
||
|
|
vim: syntax=markdown:ts=8:sw=4:ai:et:tw=78:fo=tcqn:fdm=marker
|
||
|
|
-->
|
||
|
|
</article>
|
||
|
|
</main>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|