[sane-devel] Fujitsu USB scanner support working!

Ron Cemer ron@roncemer.com
Thu, 13 Feb 2003 09:51:19 -0800


Thanks for your comments.  I'm absolutely new to SANE, so I expected 
that there would be some mistakes in my code.
(see below)

Henning Meier-Geinitz wrote:

>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.
>  
>
I was trying to do it the way that the epson does it (e.g. "usb 
/dev/usb/scanner0" in the .conf file).  Not sure whether that's the best 
approach, but that got me going initially.

>  
>
>>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@abm.de>? It's up to him to decide.
>  
>
Not yet, but I will now.  I didn't really know who to get in touch 
with.  Thanks for letting me know!

>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.
>
Here I'm just looking for something like "usb /dev/usb/scanner0" (or any 
device name prefixed with the word "usb" and a space), and if I find it, 
I'm making the decision to try to attach this scanner as a USB scanner 
instead of a SCSI scanner.

>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.
>  
>
I'll give this technique a try.  I'll have a look at the epson driver to 
see how it's being done there, and I'll try to more closely match that.

>  
>
>>+///
>>    
>>
Oops: left-over from debugging.  I use three slashes to mark debug 
statements I want to remove later, as well as hacks that I'm testing.  
I'll get rid of this.

>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.
>  
>
Do you have a list of args you like to run indent with?

>A manpage update and an updated doc/descriptions/fujitsu.desc file
>would be also nice. But I guess the maintainer can du that :-)
>  
>
I'm not sure how to update the manpage, but I can surely update the 
doc/descriptions/fujitsu.desc file.

>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)?
>  
>
I guess so.  Hadn't thought of that.

>
>Thanks for your work,
>  
>
Welcome!  Hopefully this will help lots of Fujitsu scanner users.

>  Henning
>_______________________________________________
>Sane-devel mailing list
>Sane-devel@www.mostang.com
>http://www.mostang.com/mailman/listinfo/sane-devel
>
>  
>