I have a USB printer I bought back in 2005 when I bought a Windows PC for the family. It's an HP PSC 2410 PhotoSmart All-in-One printer. 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.
This printer is well catered for under Linux and it is possible to access it using CUPS for the printing and SANE 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 article in the Raspberry Pi Geek magazine which helped with this project.
Using a Raspberry Pi
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 Pimoroni Pibow acrylic rainbow cases.
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.
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.
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.
Because the power supply for the printer seems to consume power even when the printer is off I installed one of the radio-controlled switches 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.
Picture: cat > printer
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
/etc/hosts on all of my client machines. This one ended up being called
rpi1 with the address
In the headless mode I installed CUPS. On Raspbian this brings in many other packages such as HP Linux Imaging and Printing (HPLIP), Scanner Access Now Easy (SANE) and many filters and printer drivers.
Once CUPS is installed it is fairly simple to configure it either through the
hp-setup tool or the web interface. As you might have guessed,
hp-setup 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
hp-setup -i for this and used it to configure a print queue with the
CUPS Web Interface
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 http://192.168.0.66:631/
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.
I chose to give my account "
dave" on the Raspberry Pi
sudo usermod -a -G lpadmin dave
The Raspberry Pi Geek magazine article recommends the following steps to make the printer visible from any address:
sudo cupsctl --remote-any sudo /etc/init.d/cups restart
I actually used the following to restart CUPS:
sudo service cups restart
Using the web interface I was able to create CUPS printer queues on the Raspberry Pi.
Accessing the printer
The Raspberry Pi Geek magazine article gives advice on setting up print clients on remote systems. I did this on my Debian Testing KDE system by invoking Systems Settings and selecting the Printers entry. My son did the equivalent on his MacBook in order to print.
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 HP Print Service 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.
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 SAMBA on the Raspberry Pi, but was reluctant to do so.
My daughter is away at university now, but I recently found some helpful advice on this subject on the Arch Wiki. In particular, the use of IPP (Internet Printing Protocol) seems to be the best route. Interestingly the advice is not to use SAMBA, which appeals to me!
It looks as if we can simply add a printer with the address:
Using the scanner on the remote printer should be straightforward, but I encountered some problems with this.
According to the Raspberry Pi Geek magazine article it is necessary to make the SANE daemon run all the time by editing the file
/etc/default/saned. I ensured mine contained the following:
I also edited
/etc/sane.d/saned.conf and added the line:
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:
sudo service saned restart
I then tried the following command on the Pi:
sudo scanimage -L
and saw the following response:
device `hpaio:/usb/psc_2400_series?serial=MY47KM22Y36T' is a Hewlett-Packard psc_2400_series all-in-one
Moving to my desktop system, which had CUPS installed, the same command did not find the scanner.
/var/log/daemon.log on the Pi, I saw:
Feb 21 17:14:25 rpi1 saned: check_host: access by remote host: 192.168.0.5 Feb 21 17:14:25 rpi1 saned: init: access granted to email@example.com Feb 21 17:14:28 rpi1 saned: io/hpmud/musb.c 2066: Invalid usb_open: Permission denied Feb 21 17:14:28 rpi1 saned: quit: exiting
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:
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
The USB device is owned by root and the group lp. However, the user
saned has the following groups:
root@rpi1:~# id saned uid=110(saned) gid=114(saned) groups=114(saned),110(scanner)
saned cannot access the device.
It seemed that the simplest solution was to add
saned to the
root@rpi1:~# usermod -a -G lp saned root@rpi1:~# id saned uid=110(saned) gid=114(saned) groups=114(saned),7(lp),110(scanner)
scanimage -L from the remote client returned:
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
Now it is possible for a remote system to access the scanner through GIMP, Xsane and other SANE interfaces.
It is not clear why the standard CUPS installation creates user
saned in the
scanner group where the device is owned by the
lp group. I have not determined if this is a problem with the
saned user or the UDEV code that creates the device.
Accessing the scanner from Mac OSX and Windows
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.
This is obviously an area for future development!
- HP PSC 2410 PhotoSmart All-in-One printer: http://h10025.www1.hp.com/ewfrf/wc/product?cc=uk&lc=en&product=303753
CUPS.orgmain web site: https://www.cups.org/
- CUPS Wikipedia entry: http://en.wikipedia.org/wiki/CUPS
- HP Linux Imaging and Printing (HPLIP): http://hplipopensource.com/hplip-web/index.html
- Scanner Access Now Easy (SANE): http://en.wikipedia.org/wiki/Scanner_Access_Now_Easy
- "Converting the Raspberry Pi to a wireless print server" from the Raspberry Pi Geek magazine: http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server
- Linux Foundation OpenPrinting work group: http://www.linuxfoundation.org/collaborate/workgroups/openprinting/
- HP PSC 2400 series details: http://www.openprinting.org/printer/HP/HP-PSC_2400
- Arch Wiki on CUPS - Linux Server Windows Client: https://wiki.archlinux.org/index.php/CUPS_printer_sharing#Linux_server_-_Windows_client
- Internet Printing Protocol (IPP): https://en.wikipedia.org/wiki/Internet_Printing_Protocol