Economy Size Geek - Adventures in Scanning
I am running Karmic (9.10), but by the time this article is printed, Lucid (10.4) will be released. Simple Scan is being included as part of the release. Simple Scan is a new scanning tool focused on making scanning, in a word, simple. Because it currently is available as part of a PPA (Personal Package Archive), adding it to my system was easy:
sudo add-apt-repository ppa:robert-ancell/simple-scan sudo apt-get update sudo apt-get install simple-scan
The first time I tried Simple Scan, it failed. That was a bit frustrating, but it was my own fault. I had xsane open at the same time. It turns out that each application claims ownership over the device. Once I closed xsane, Simple Scan worked like a champ. It really is simple, and it can do photos or text. Plus, it made making a multipage document as easy as just continuing to scan. xsane gives you incredibly fine-grained control. There probably are situations where I would be glad it includes a histogram of the image, but when all I am trying to do is sign a contract, scan it and e-mail a PDF, Simple Scan fits the bill.
One word of warning before I move on. After spending some time using Simple Scan, I hit a problem. Simple Scan depends on the convert command from ImageMagick to make a multipage PDF from a series of scans. On Karmic, this results in a segmentation fault. I was able to locate a bug report confirming that this problem has been resolved for Lucid, but not for Karmic. There are three options: upgrade to Lucid, pull in only the Lucid packages, or pull in an updated ImageMagick from Raimar Sandner's PPA (see Resources). Long term, I plan to upgrade to Lucid. For now, I just used Sandner's PPA to pull in a fixed version. I was able to confirm that this works.
After having such a pleasant experience getting my scanner working, I realized I was up for more of a challenge. At my office, I have an HP LaserJet 3055. It's one of those multifunction copier, scanner, fax and printer machines. The v300 scanner I used at home was connected directly to my Linux box. In the case of the HP, I have to connect over the network. Will it be as simple to set up as the single-function Epson?
At first, I wasn't sure where to start. There didn't seem to be any tools to detect the scanner on the network. Then I realized I had already been through this process. Step one with the scanner is finding out whether special drivers exist. In this case, the key phrase is “HP Linux Imaging and Printing” system, or HPLIP for short:
sudo apt-get install hplip-gui
Once that is done, I needed to run hp-toolbox to configure the network printer. This provides a handy icon in the GNOME alert bar that lets you select actions for the multifunction printer. By choosing Scan, it automatically starts xsane. I found the configuration under Preferences in the HP system tray application to change it to Simple Scan as the default application. For some reason, it refused to find the HP scanner when I launched it from the system tray. At the moment, I'll chalk that up to something that will get ironed out, as a bug report says the switch will be official in Lucid (see Resources). On the plus side, now that the HP is completely installed, I can start xsane or Simple Scan and then choose the HP for scanning. Scanning under Linux really has come a long way.
I now have both scanners working, so I decided to dig a littler deeper into scanner configuration. My Epson scanner has three hardware buttons: PDF, Email and Copy. It would be cool if I could press the PDF button and have it automatically start Simple Scan and start scanning. To do that, I needed to use a tool called scanbuttond. This is a dæmon that runs in the background and monitors the status of the scanner buttons. It then allows you to trigger scripts based on the button pushed:
sudo apt-get install scanbuttond
I started the dæmon by running:
The application still logs to /var/log/syslog, but the -f option keeps it in the foreground, so it is easier to kill as I work through the configuration issues. Right away, things got off to a bad start. My log file quickly filled with:
Apr 1 21:30:24 barqs scanbuttond: rescanning devices... Apr 1 21:30:24 barqs scanbuttond: no supported devices found. rescanning in a few seconds... Apr 1 21:30:26 barqs scanbuttond: rescanning devices... Apr 1 21:30:26 barqs scanbuttond: no supported devices found. rescanning in a few seconds...
Now I know why they provide a -q option to quiet the log messages. The problem seems to be that the system doesn't know how to detect my scanner. After spending some time on Google, I determined that the way to solve the identification problem is to modify the source of scanbuttond to detect the scanner. Using lsusb, I was able to code to add to scanbuttond. I recompiled the package and got a notification that it found my scanner.
After all of that, I learned that even more work was needed. scanbuttond uses libusb to communicate with the scanner. This allows it to talk to the scanner without locking it up (the way xsane and Simple Scan do). As a result, in order to get the button presses, you have to know precise codes to send to the scanner to get a response. Once I realized that, I was able to confirm that the Epson scanner I have acts completely differently from the other scanners that scanbuttond knows about. If I knew more about USB debugging, I might have had a shot at fixing the problem.