I’ve been using the SANE backends with the XSane plugin for GIMP for many years now, but because of digital photography I don’t seem to need the scanner much these days. When we got the senior photos for my daughter, however, I needed a way to make a few copies for wall mounts at work. So it was time to make sure the scanner was working again.
While SANE hasn’t changed much other than adding drivers for more scanners, the infrastructure in which those drivers runs has evolved quite a bit. Most importantly the mechanisms for authorizing users to access the device files that are associated with the scanners. Sadly, those mechanisms have gotten more complex thanks to the nasty habits of those people who would attempt to do things on your computers that they aren’t supposed to do.
I have an Epson Perfection 1260 Photo scanner which connects to one of my servers at home via a USB port. I don’t use the scanner on that machine but rather connect to it over the network from other systems. So my configuration process requires first making sure the scanner is accessible to the server and then configuring the server so that remot clients can access it too. The latter step also requires configuring the remote clients but that’s extremely trivial to do.
The process I’m about to explain works for my scanner specifically becaues it connects via USB. Parallel port scanners and SCSI connected scanners have different configuration issues, though they all probably have to deal with the authentication wrappers Fedora introduced with Fedora 9.
The first thing to do after connecting the scanner to the USB port is find out where the scanner lives. This is done with the sane-find-scanner tool. Running this as root produces the following output:
found USB scanner (vendor=0x04b8 [EPSON], product=0x011d [EPSON Scanner], chip=LM9832/3) at libusb:002:002
The vendor and product IDs will be needed to configure the appropriate SANE backend (aka driver). I already know from reviewing the SANE manufacturers pages that the Plustek driver is used for this particular scanner. Note that the Epson driver is not used here. That is because the drivers, though named for manufacturers, are actually designed to work with specific chipsets (much like video drivers). It just happens that the Plustek driver supports the chipset (LM9832) that my Epson Perfection scanner uses. On older systems (Fedora 8 and prior) the USB port listed next to libusb might have been needed but that isn’t the case with Fedora 10.
With the required driver and scanner information in hand, I’m ready to configure SANE. There are three files under /etc/sane.d to edit: saned.conf, dll.conf and plustek.conf. The sane.d conf file tells the SANE daemon (which we’ll configure in a moment under xinetd) which remote systems may access local scanners. The dll.conf file tells the SANE system which drivers to use. My dll.conf has only the plustek driver enabled though it doesn’t hurt to leave others enabled even if you don’t use them. The plustek.conf file configures (through a single modification to the [usb] line) the driver to work with the Epson Perfection.
We haven’t configured the network access to the scanner yet, but first we need to make sure local users can access the scanner. In earlier versions of Fedora this was done with a udev configuration file. This file is no longer part of the SANE packages which prompted me to search for where it had gone. Turns out that you now need to use PolicyKit to grant authorization to the port.
I’m just barely familiar with this function in Fedora since I tend to disable all the SELinux and security measures (except firewalls) on my systems. Yes, I know this is a bad idea. But they tend to require more systems administration from my than I’m willing to give. I want to work, not administer my damn systems. So I turn things off.
In this case, though, I don’t know how to disable it but I did figure out that opening Preferences->System->Authorizations setting Implicit Authorizations for Anyone to Yes seemed to do the trick. I didn’t specify which devices or files this applied to. Take a look at this dialog to see what I mean.
Once this is done you can verify you have access usingscanimage program. This is part of the SANE package. If you run
scanimage -L
as your normal login (a non-root user) then you should see the scanner:
device `plustek:libusb:002:002′ is a Epson Perfection 1260/Photo flatbed scanner
If you don’t see this when scanimage is run as the non-root user but you do see it when you run scanimage as the root user then you still don’t have PolicyKit configured correctly. Play with the PolicyKit settings – I’m not sure what works yet but I know PolicyKit is the culprit in these cases.
You can also verify access to the scanner using the XSane program or by using the xsane plugin in the GIMP. Both of these are available as installable RPM packages: xsane and xsane-gimp.
Once the scanner is accessible on the local machine the next step is to enable it for network access. This can be done by installing the xinetd package and then added a sane configuration file to /etc/xinetd.d/. This configuration file has (in my linked example) a user configured that I tested access to the scanner with GIMP on the local machine. By setting that user in the configuration file I know my remote users will be able to get to the scanner. After installed the configuration file the xinetd daemon must be restarted:
sudo service xinetd restart
If you use the copy of the sane file for xinetd I’ve provided here, be sure to change the user and group entries to your own user id.
That’s it on the server side. To get access to the scanner from a remote system you simply add the name (or IP address) of the server to the /etc/sane.d/net.conf file. In my example I have one line that states the name of the remote server (feynman). This name is mapped to an IP address in the /etc/hosts files on both systems.
That’s it. As long as the gimp, sane, xsane and xsane-gimp packages are installed on your remote system you’ll be able to access the remote scanner using GIMP through the File->Create->XSane Device Dialog menu option in GIMP 2.6.