From: www.itworld.com
March 20, 2001 —
It wasn't easy. I followed several paths that did not lead to nirvana. But now there is peace and harmony. My HP ScanJet 5200C is a tamed beast. The scanner is not only docile and compliant, but it speaks fluent USB. You may recall that in a recent column, I described my frustration with trying to get the scanner working. It had worked once -- though only partially and ever so briefly. But after I reinstalled everything so I could faithfully take notes and report my experiences in the column, I was unable to make the scanner work again.
My quest led me to try multiple versions of the kernel: from 2.2.18-x to test releases of 2.4. When they didn't bring relief, I changed distributions. I switched from Red Hat 7.0 to Debian Potato to SuSE 7.0 to Mandrake 7.2, to no avail.
But after receiving clues and inspiration from my local LUG's mailing list, I finally realized I had been looking in all the wrong places. It's the hardware, stupid, not the Linux kernel or the distribution. A bad motherboard. A very bad motherboard.
In the message that helped me, the author noted how easily he made the same scanner work using USB on Mandrake 7.2. No need to upgrade the kernel at all. After just a few simple steps (I'll go over the complete process later), he was enjoying his new scanner. Naturally, I misread the answer. I was still in my "blame the software" funk and concluded that if I just installed Mandrake 7.2, I could use my new scanner too.
I ran into town and picked up a copy of Mandrake 7.2. SuSE came off my system; Mandrake went on. I followed the mailing list's instructions to the letter. The results were different, but still not good. Instead of giving me segfaults when I started xscanimage, the application just sat there and did nothing.
Out of curiosity, I decided to run usbview. When I started it, an empty window appeared. But when I clicked on Refresh in the Usbview Menu, the screen filled with information about the scanner. Amazingly enough, accessing USB with usbview caused the xscanimage program to come unstuck.
The xscanimage opening screen appeared just a few seconds after I hit Refresh: very suspicious behavior. A tiny LED in the back of my head began to blink "Hardware Error!" But even after usbview's push start, xscanimage still would not work. When I tried to do a scan preview, xscanimage would start the preview and then freeze. I was becoming convinced that I was suffering from a case of bad iron.
I made another trip to town. A message on the mailing list had said you could buy a PCI USB card for only $20. I found a Gigabyte mainboard marked down to $50. I figured that for the extra $30, I could swap out all possible hardware and firmware causes. Out came the Jetway motherboard; in went the Gigabyte. Without changing any settings, I tried xscanimage hp again. Praise Baud! It worked. My HP did a full scan and picked up all three photos I had in the scanner bed. Then I experimented with the preview scan and found I could select any part of the scan bed and scan only that area. Finally, after weeks of frustration, I had a working USB scanner.
As my editor pointed out a couple of weeks ago, SANE stands for Scanner Access Now Easy. When I was still suffering from faulty silicon, that seemed like a misnomer. Now I see that it really is easy. A new version of SANE has been released since I first tried to make my HP scanner work. Among other things, SANE is now divided into two parts: one for the backend, which talks to the scanner, and one for the frontend, which talks to the user. That's a natural division because SANE is designed to access a scanner across a LAN. In a small office or a home LAN, it may be more convenient to attach a scanner to one machine and share it by accessing it from other machines, just like you would with a network printer.
Follow these steps to make the latest version of SANE (1.0.4) work with your HP ScanJet 5200C, connected via USB, running Mandrake 7.2. If you don't wish to compile and install the latest version, you can skip the first step and find binary packages elsewhere on the Web or use those included with your distribution.
tar xzf sane-backends-1.0.4.tar.gz.cd sane-backends-1.0.4../configure.make.make install.sane-frontends for sane-backends.
OK. If those instructions made you tense, relax. If there is a hard part, that was it. The rest of the process -- configuring the system -- is a snap. Whether you've installed from executable binaries or built the programs yourself, this is all you have left to do.
mknod /dev/usbscanner c 180 48.chown username.groupname /dev/usbscanner where username and groupname are correct for you. /etc/sane.d/hp.conf to replace the two default lines (which assume SCSI connectivity) with:
/dev/usbscanner option connect-device
insmod scanner.
That's it. You're done. As a normal user, type xscanimage hp and enjoy the scanner. It's all so easy now, compared to the death march I endured before. The xscanimage program can run as a plug-in for GIMP. I've found that to be a very good thing; I almost always run GIMP to modify and save the raw scanned image. Making xscanimage accessible from GIMP is easy too.
All you need to do, assuming you have GIMP installed and have used it at least once, is type ln -s /usr/bin/xscanimage ~/.gimp-1.1/plug-ins. Different distributions may put xscanimage elsewhere. If it's not in /usr/bin, use the locate xscanimage command to track it down. The next time you start GIMP, you can access the scanner from the Xtns, Acquire Image, Device Dialog menu selection. It is very handy indeed to have that great software working together.
There is an alternative GUI frontend to the xscanimage program called XSane. Like xscanimage, XSane can run in standalone mode or as a GIMP plug-in. XSane does not operate strictly as a scanner. In copy mode, it outputs the scanned image as a postscript file for immediate printing. In fax mode, it feeds the output directly to a fax program, such as HylaFAX.
You can download, configure, make, and install the latest version of XSane (0.69 was released on Dec. 30, 2000) by getting it from the XSane homepage (see Resources for a link) and following the steps above -- use the XSane file and directory name instead of sane-frontend. You can also find binary versions on the Net or packaged with your Linux distribution.
To access XSane from GIMP, simply type ln -s /usr/local/bin/xsane ~/.gimp-1.1/plug-ins to create the symbolic link. From inside GIMP, access XSane from the File, Acquire, XSane menu options -- not from the Xtns menu, as with xscanimage. It's good to have a fast, high-quality scanner attached to your Linux machine. SANE makes it work, and XSane lets it do more for you. Throw in the GIMP, and you have a remarkably nice scanning environment.
LinuxWorld.com