[sane-devel] Re: Debian SANE HP bug report

Henning Meier-Geinitz henning@meier-geinitz.de
Tue, 30 Jul 2002 20:29:18 +0200


Hi,

On Tue, Jul 30, 2002 at 07:59:05PM +0200, Peter Kirchgessner wrote:
> The problem is that the USB-device is tried to be opened as a 
> SCSI-device. And then I assume it segfaults somewhere below 
> sanei_scsi_open(). Because of the missing option connect-device.
> Do you have an idea how to check if a device name is a SCSI-device or 
> not ? And this should work not only for Linux.

I don't think there is a generic solution. The Linux test is
implemented in 1.0.8, other platforms should be possible but nobody provided
patches until now.

> I could just add a check to see if the device name contains something
> like usb and then assume that it is not a SCSI device. 

Have a look at tools/sane-find-scanner.c. I'm using this kind of
heuristics to make sure it's not a USB scanner:

  if (strstr (file_name, "usb")
        || strstr (file_name, "uscanner") || strstr (file_name, "ugen"))
	    {
	      /* looks like a USB file */
	    }
	    
However, nobody stops the user from naming his USB scanner /dev/uscn0
or anything else. And the test is the other way round, it can't test
for SCSI.

Bye,
  Henning