From: www.itworld.com

Driven crazy by SANE

by Joe Barr

March 20, 2001 —

 


I need help. SANE is making me crazy -- SANE, as in the Scanner Access Now Easy project. (See Resources for a link.) The problem is SANE via USB, actually. I had it working, honest. My brand new HP 5200C scanner was doing a fine job of scanning old photographs. I was using my new 750-MHz Athlon test machine, running Red Hat 7.0 with a test version of the Rawhide 2.4 kernel. I used xscanimage, for example, to get a copy of the photo you see below: my grandfather's service station and garage in Indiahoma, Okla., circa the early 1920s.


I was so thrilled that USB was working on my system, and by the prospect of being able to scan and preserve a lot of old family photos, that I decided then and there to write a column about it. Unfortunately, I had not taken thorough notes while I cobbled the thing together. I decided that the best thing to do was reinstall everything and write down every step. That would allow readers who were so inclined to do the same thing.



Besides, not everything was really working that well. When I tried to preview an image using XSane, the scanner started clattering so loudly, I thought it might destroy itself. I hoped a reinstall would fix that, so I wiped the disk clean and began anew, notebook in hand. That turned out to be a very big mistake.

A scanner darkly

Actually, the new hardware was a bit problematic before and after I reinstalled everything. I finally tracked down the problem: a bad DIMM. It caused the system to lock up at odd times before, during, and after the reinstall. Since removing it, my system has not yet been revisited by the "freeze that knows no thaw." As pesky as that problem was, it turned out to be the least of my worries.


I started by reinstalling Red Hat 7.0 Professional. Every time I tried to run xscanimage in my previous install, I got an error message saying it could only be run as a plug-in for the GIMP. I thought I would avoid that problem the second time by specifically selecting the xsane-gimp package. I also thought usbview looked interesting, so I selected that too. Other than those two packages, the Red Hat 7.0 install was identical to the first. I'm still happy that I chose usbview; it was about the only thing connected to USB that seemed to work correctly.

Scanned photo using xscanimage

I could see USB activity at boot time, even in the 2.2.16-22 kernel that Red Hat 7.0 is based upon. The UHCI (Universal Host Controller Interface) module loaded; soon after, a message appeared saying the USB filesystem was mounted.


Better yet, when I ran usbview, it neatly identified my HP Scanner and gave me a lot of specifics about its USB configuration. But none of the SANE tools saw it, even after I edited hp.conf in /etc/sane.d and made sure the permissions on /dev/usb/scanner0 were set correctly. Oh well, I knew starting out that I would need a bleeding-edge kernel to get the latest USB stuff. What I didn't know was how much of the blood would be mine.


LinuxWorld.com links

Then it was back to that great stash of RPMs on the Net: rpmfind.net. (See Resources for a link.) I grabbed the 2.4 test kernel represented as Rawhide 1.0 for Intel -- the 686 version, not the 386 I had originally tried. After installing the kernel rpm, I modified /etc/lilo.conf to point at Rawhide 1.0 instead of the 2.2 kernel, then ran LILO. Finally, I was ready to reboot and configure the scanner again. Or so I thought.


The kernel wouldn't boot. I couldn't be sure at that point what the problem was. Using the 686 version on a K-7 CPU? Maybe. I downloaded the 386 version again and installed it. Now I could boot, but I got segfaults when I tried to use the scanner. I tinkered and tweaked. Finally, I threw up my hands and decided to reload Red Hat from scratch, this time excluding usbview and xsane-gimp.


Then I went back to rpmfind.net. My column deadline was approaching, and when every attempt to download the kernel rpm failed, I began to suspect I would never finish in time. That was one of the few things I was right about in the past few days. I tried for hours to download the package, but got the same error every time: the file named could not be found.


The next morning, the original Rawhide 2.4 kernel versions I had used were gone. In their place was a new version, 2.4.0-0.43.4. Time was short: no experimenting with the 686 version this time. I chose the 386 version and watched with relief as the FTP finally began. This is even better, I thought. A more recent version with more and better USB stuff inside.


Ha.


The newer version of 2.4 wouldn't boot either. It complained that my SCSI boot filesystem couldn't be found. The tiny fool. Little did it know that I don't have any SCSI devices. Whatever the problem was at that point -- most likely something I had done wrong, not a problem with the package -- it was too late for me to solve it. I gave up completely on using the 2.4 kernel and pinned all my hopes on 2.2.18, the most recent 2.2 version with all the latest USB goodies backported from 2.4.


The good news: the 2.2.18 version would boot. That cheered me considerably. But the segfaults that occurred when I tried to use the scanner brought me back down.

Slinking back

Surely something evil was at work. Something proprietary and nasty in the bowels of Red Hat 7.0 was causing me all of this pain. Then I noted a blurb on a new release of Debian that said it was based on 2.2.18. That was the ticket! I could purify myself in the politically correct waters of Debian. And when I got the scanner working on Potato, I could chortle mightily at those lamers who toiled with commercial distributions! CNN was on the TV; the U.S. Supremes had reached a decision on Bush vs. Gore. Well, good for them, but I had reached a decision, too. Red Hat was out. Potato was in.


I found the "official" boxed Debian package that LinuxMall.com had finally delivered, weeks overdue and long after I had critiqued Slink and been subsequently subjected to the outrage of the Debian faithful for using an outdated version. Now the Potato box would come in handy (or so I thought). You know what they sent me, months after the release of Potato? That's right: another Slink box, just like the one I had received in San Jose last August. Joey Hess should tell his employers at VA Linux to destroy all those boxes if they don't want them to be used and reviewed.


But I was determined. I would not be turned away. I was no hanging chad, turning first one way and then the other. I downloaded the boot floppies and drivers from the Debian site and installed the latest version of Potato over the Net. Yes, it took hours and hours with my 128-Kb ISDN line. But it was finally done. I was half a day past my deadline, but I was ready to see if USB and I could be friends once more. But no -- it was segfault city all over again each time I tried to access the scanner.


Now, I know many of you reading this column are not dweeb like me. The scanner supports both USB and parallel ports, and even includes a printer cable. You are probably scratching your head and wondering why I didn't just use the parallel port and printer cable instead of fighting with USB. To you I say, because it is there.


Others will understand with no explanation. To you I turn, my brothers and sisters. Help me slay this monster. There must be a way, even in the land of daily updates to the USB code, to get my scanner working again. Help me!

Resources