[sane-devel] CanoScan N650U "scanner.c" vs. "libusb"

Gunther Mayer Gunther.Mayer@t-online.de
Fri, 22 Mar 2002 16:03:09 +0100


Steve Blackwell wrote:
> 
> Hi all,
> 
> I'm new to the list so please bear with me.
> 
> I have a CanoScan N650U scanner that I'd like to use with my RH7.1
> system. It appears that it is not currently supported.  Is anybody else
> thinking about writing a back end for this device?
> 
> I'm not really clear on how SANE interacts with the kernel modules
> usbcore, usb-uhci and scanner. Does SANE replace scanner? Perhaps ther
> is no relationship at all. Can someone attempt to explain this to me or
> point me to some documentation that might help.

"scanner.c" as in linux-kernel is misleading, as it does things
that should be separate. On the long run it creates more problems
than it solves (it tries to hide/abstract the fact that it is USB from user-level
application; this is the wrong way)

Essentialy it boils down to
"scanner.c" = List of Scanner USB_IDs + Some Knowledge about endpoints + generics USB routines (read/write)

If a scanner is recognized by "scanner.o" it means nothing !
The hard work must be done anyway by the user level driver.

Better solution: 
libusb (comparable to "sg"="scsi generic" or "ide taskfile") exposes the USB API
to user space.

So I decided to use "libusb" and ignore "scanner.c" in my Canon N670U driver,
see http://home.t-online.de/home/0531896113/merlin670-V0.02.c 

Currently this is stand-alone, as I can't make friends with SANE's data type redefinitions,
I plainly refuse using SANE_Byte or SANE_Bool when I have "unsigned char" and "int",
this is over-design.
-
Regards, Gunther