Scanner setup

From Smith family
Jump to: navigation, search
Server setup
← Previous Next →
Print server Git

Install HPLIP

I've got a multi-function printer (HP 1312). Scanning for this printer is not supported in the HPLIP that comes with Ubuntu. So I need to update it.

NB: Update the software before attaching the printer.

  • Don't remove any existing HPLIP installation, as you need it for libraries used by the installer. If necessary, add these packages:
root@desktop:~# aptitude install hplip hplip-gui hpijs hpijs-ppds foomatic-db-hpijs printer-driver-postscript-hp
root@desktop:~# hp-plugin-ubuntu

That's it!

(See also the printer setup page)

Server setup (untested)

(We're using the desktop machine as the server for the scanning service.)

  • Add xsane and sane-utils and xinetd packages (sane-utils and xinetd only for non-GUI machines)
root@desktop:~# aptitude install xsane xsane-doc sane-utils xinetd
  • No additional work should be needed for doing the scanner under the first-created user. Check that this user can access the scanner, either with xsane or scanimage:
user@desktop:~# scanimage -L

Making the scanner available to the rest of the network takes a bit more effort, mainly because scanner device identification is broken in Ubuntu 8.04.

  • Find the manufacturer and device IDs for your scanner
root@desktop:~# lsusb
You'll get a line something like
Bus 005 Device 004: ID 03f0:4e17 Hewlett-Packard
In the ID field, the first number (03f0) is the vendor's code and the second (4e17) is the device code.
  • Create the file /etc/udev/rules.d/41-scanner.rules
# Hewlett-Packard Color LaserJet CM1312 MFP
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
                 ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="4e17", \
                                       MODE:="0664", GROUP:="scanner"
(as described in this forum post and this bug report). Replace the vendor and product codes with the ones you found above. Note that the rules are case sensitive and the colons in the assignments are required.
  • Restart udev
root@desktop:~# /etc/init.d/udev restart
  • Add users who want to use the scanner to the scanner group. In particular, add the saned user.
root@desktop:~# adduser saned scanner
  • Test that users can access the scanner
root@desktop:~# sudo -u saned scanimage -L
device `hpaio:/usb/HP_Color_LaserJet_CM1312_MFP?serial=00XXX886XXX2' is a Hewlett-Packard HP_Color_LaserJet_CM1312_MFP all-in-one
  • Create the file /etc/xinetd.d/saned so that xinetd knows about the saned daemon
service saned
{
       socket_type = stream
       server = /usr/sbin/saned
       protocol = tcp
       user = saned
       group = scanner
       wait = no
       disable = no
}
  • Add the following line to /etc/sane.d/saned.conf to share the printer with all computers on your subnet:
192.168.1.0/24
  • Restart xinetd
root@desktop:~# service xinetd restart
  • Open the right port in the firewall by adding these lines to /etc/iptables.rules. Make sure the scanner is only available to machines on this LAN.
## Network scanning (port 6566)
# Only accept packets from the LAN
iptables -A INPUT  -i $IFACE -p tcp -s $LAN --dport saned -j ACCEPT
and restart the firewall
root@desktop:~# /etc/init.d/iptables restart
  • As this is a multi-function printer, restart CUPS and check that it can still print to the printer.

Linux client setup (untested)

(We're using the server machine as the client for the scanning service.)

  • Add xsane and sane-utils and xinetd packages (sane-utils and xinetd only for non-GUI machines)
root@server:~# aptitude install sane-utils xinetd
  • Add the server name or IP address of the scanner server to /etc/sane.d/net.conf
192.168.1.251
  • Test the users can access the scanner
root@server:~# scanimage -L
device `net:desktop.domain.tld:hpaio:/usb/HP_Color_LaserJet_CM1312_MFP?serial=00XXX886XXX2' is a Hewlett-Packard HP_Color_LaserJet_CM1312_MFP all-in-one

Windows client setup (untested)

Use SaneTwain and follow the instructions. Unfortunately, I couldn't get the scanner working reliably across a network at all, so SaneTwain didn't have a hope of working.

See also