Scanner setup

From Smith family

Jump to: navigation, search
Server setup
← Previous Next →
Print server Subversion

Contents

Install HPLIP

My printer (an HP 1312) is supported by HPLIP, but is only supported for scanning with a plugin. Unfortunately, the HPLIP that comes with Ubuntu breaks when it tries to install a plugin. This is fixed with the installation of HPLIP direct from HP.

  • Remove the existing packages
root@desktop:~# apt-get purge hplip hplip-gui hpijs hplip-cups libhpmud0 hpijs-ppds foomatic-db-hpijs
  • Download HPLIP from HP.
  • Run hplip-3.10.5.run to install it. Don't run it as root, but as an ordinary user. The instructions from HP are useful.
user@desktop:~$ sh hplip-3.10.5.run
  • When it asks you for root access to set up the printer, cancel.
  • Run hp-setup to set up the printer with root privileges. Ignore the errors that come when it does so.
root@desktop:~# sudo hp-setup

(See also the printer setup page)

Server setup

(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:~# apt-get 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:~# /etc/init.d/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

(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:~# apt-get 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

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

Personal tools