[sane-devel] Proposal: sanei_usb interface for USB scanners

Marcio Luis Teixeira marciot@holly.colostate.edu
Sun, 05 Aug 2001 18:52:52 -0600


I am *very* interested in this, because I have been developing a
backend for the UMAX 1220U scanner and have been wishing
for better standardization in this area.

I am particularly interested in knowing if your interface would
be able to support for the PowerVision 8630 USB-to-parallel
bridge. UMAX1220U and the HP4200 scanners both use this
chip, and I imagine others do as well. Adrian Perez Jorge has
written a very nice and sweet set of PV8630 interface file for
his HP4200 backend. I have adapted these files for use in my
own backend.

I have two questions for you: First, do you think it would be
possible to adapt Jorge's PV8630 interface to use the sane USB
interface you propose? I've posted the code here, if you need to
look at it (it's very short):


Second, I know the Linux kernel has some degree of support for
USB scanners, through code written by David Nelson. These are the
two files called "scanner.c" and "scanner.h". Is this what you meant
by "the Linux USB scanner module"? If so, that is good news, since
the PV8630 interface code I mentioned above uses that already.

Anyhow, I am very interested in anything that would allow me to
make my Umax backend more compatible with the rest of the world
and I applaud your efforts to standardize things!

Your comments on these questions would be very much

Thank you,

Marcio Luis Teixeira

Henning Meier-Geinitz wrote:

> Hi,
> I have just written a quick-and-dirty interface for USB scanners like
> sanei_scsi is for SCSI scanners. It's not as generic as the SCSI one,
> however. Currently it works only with device files, so e.g. the Linux
> USB scanner module is supported. I don't know if it's easy to add
> support for libusb; is there documentation for it anywhere? Would it
> be possible to add support for the scanners with their own kernel
> drivers without too much dirty tricks?
> The following functions have been implemented in sanei_usb.c:
> sanei_usb_open
> sanei_usb_close
> sanei_usb_read_bulk
> sanei_usb_write_bulk
> sanei_usb_get_vendor_product
> sanei_usb_find_devices
> The first for functions are simple and just map to the low level open
> etc. functions and so some error reporting. They have been lightly
> tested with the mustek_usb backend so more testing is necessary.
> The last two are a bit more complicated:
> sanei_usb_get_vendor_product tries to find out vendor and product ids
> for a given device file by asking the USB scanner driver via ioctls
> about them (if available). This works only with the latest Linux
> versions. This functions allows backends to check if the device file
> they use is connected to a scanner they support. If the Linux ioctl is
> not available at least it's checked if the file can be opened
> (something is listening to the device file). This can also be used in
> sane-find-scanner to check all the /dev/usb/scanner files for
> connected scanners (see below).
> sanei_scsi_find_devices goes the other way round: it returns a device
> file for a given vendor and device id. It has the same limitations as
> above. With this function it's possible to use "usb 0x1233 0x321" in
> the config file (similar to the "scsi" command) to find a device file
> for the USB scanner with these ids.
> New files: sanei/sanei_usb.c, include/sane/sanei_usb.h
> Updated:   tools/sane-find-scanner.c (+Makefile)
>            sanei/sanei_config2.c (+Makefile)
> sane-find-scanner now tries to find USB devices. sanei_config2 has the
> extention for the "usb vendor product" line in config files.
> The changes can be downloaded from
> http://www.meier-geinitz.de/sane/download/sanei_usb-2001-08-05.tar.gz
> It's a tar.gz file containing all the updated and new files because I
> didn't know how to include files into "cvs diff" that are not yet
> added to CVS. Just untar it in the sane-backends directory.
> Thanks to Karl Heinz Kremer for the info about the Linux ioctl.
> Comments? Additions?
> Bye,
>   Henning
> _______________________________________________
> Sane-devel mailing list
> Sane-devel@www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel