[sane-devel] Fujitsu USB scanner support working!
Henning Meier-Geinitz
henning at meier-geinitz.de
Thu Feb 13 10:58:51 GMT 2003
Hi,
On Wed, Feb 12, 2003 at 02:19:39PM -0800, Ron Cemer wrote:
> Attached is a patch file which can be applied to sane-backends-1.0.11.
> It adds support for the Fujitsu fi-4220C flatbed/ADF scanner, over USB.
That's cool.
> I don't have access to any other Fujitsu scanners, but I would venture
> to guess that this is likely to work with any SCSI/USB Fujitsu scanner.
> The majority of the patches are to add USB support for Fujitsu
> scanners. Fujitsu uses a SCSI/USB chip, an Espon S1R72105. When
> talking USB, they wrap the SCSI commands using a non-standard variation
> of the USB mass storage protocol. That's what I've implemented in order
> to get USB support working.
Ok. So it's better to keep the SCSI-over-USB stuff in the fujitsu
backend instead of making a sanei file.
> For the /etc/sane.d/fujitsu.conf config file, comment out everything and
> just add a line like this:
> usb /dev/usb/scanner0
That's not really "standard" but I'll comment on this later.
> Could these patches be applied to the current development version of
> sane-backends, so that others can benefit from them?
Did you talk to the fujitsu backend maintainer Oliver Schirrmeister
<oschirr at abm.de>? It's up to him to decide.
Some comments (I don't have a Fujitsu scanner, just from looking
through the patch):
> else /* must be a device name if it's not an option */
> {
> + if ((strncmp ("usb", lp, 3) == 0) && isspace (lp[3])) {
> + lp += 3;
> + lp = sanei_config_skip_whitespace (lp);
> + mostRecentConfigConnectionType = SANE_FUJITSU_USB;
> + }
> strncpy (devName, lp, sizeof (devName));
> devName[sizeof (devName) - 1] = '\0';
> sanei_config_attach_matching_devices (devName, attachOne);
> + mostRecentConfigConnectionType = SANE_FUJITSU_SCSI;
> }
> }
That won't work with the "usb vendor product" lines. You're opening a
fixed USB device name without checking for vendor and product ids if I
didn't miss anything. So you don't know which scanner you are talking
too. This may freeze SANE if it's not a Fujitsu scanner. And it means
you must adjust the file name, e.g. it would be /dev/uscanner0 on
FreeBSD. For some systems, there is no kernel scanner driver at all
and even on Linux, the user may want to use libusb. So I wouldn't use
this manual way of detecting USB scanners. Use the standard "usb
vendor product" detection scheme (with
sanei_usb_attach_matching_devices) and check for vendor and product
ids. If you want to also support fixed device names (e.g.
/dev/usb/scanner0), you could check for "usb /" and run attach with
the device name manually.
> +///
Please don't use C++-style comments, they are not supported by all
compilers.
Please also have a look at the coding style, indent should be able to
"fix" that.
A manpage update and an updated doc/descriptions/fujitsu.desc file
would be also nice. But I guess the maintainer can du that :-)
Until it's included, I'll update the entries in our scanner list to
point to this patch.
Don't you want to add your copyright to the top of the file(s)?
Thanks for your work,
Henning
More information about the sane-devel
mailing list