[sane-devel] All sane frontends segfault with my HP 5200C

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 3 Feb 2002 18:38:35 +0100


Hi,

On Sun, Feb 03, 2002 at 02:58:25PM +0000, Nick Lamb wrote:
> On Sun, Feb 03, 2002 at 12:52:04PM +0000, Major A wrote:
> > The problem with this is that it is very platform-specific, and, even
> > worse, dependent on whether you use devfs or not (in devfs, in the
> > long run, major/minor numbers will be assigned dynamically).
> 
> I am finding the implicit assumption of this thread hard to believe.

Hey, I asked because I had no idea so every new one is ok :-)

> Why can't you use an ioctl to distinguish SCSI devices from things which
> are not SCSI devices? As far as I understood there were already
> precautions in place to prevent SANE from grabbing an innocent disk and
> thrashing it in the mistaken belief that it is a SCSI scanner.

I don't know if there is a test in sanei_scsi. The backends usually
test for type scanner or processor in the inquiry.

> e.g. On Linux, sending SCSI_IOCTL_GET_IDLUN to /dev/scanner will have
> the effect of either (1) Returning some useless bus layout info which
> implies that it is in fact a SCSI scanner or (2) Returning EINVALID
> which means it's not a SCSI device.

Sounds ok if this interface is stable for the different kernel versions.

> I'm not picking SCSI_IOCTL_GET_IDLUN as special, I'm sure someone who
> spends more time up to his/her nick in Linux sg.h will suggest a more
> appropriate ioctl, however this is infinitely preferable to looking at
> some static list of "special" major/minor numbers.

The ioctl number is not very much less "special" but this solves the
devfs problem.

However, checking USB devices this way won't work because the ioctls
for the scanner driver have been introduced only recently.

But I think the /dev/scanner --> /dev/usbscanner problem is the most
important one.

Bye,
  Henning