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

Major A andras at users.sourceforge.net
Sun Feb 3 12:52:04 GMT 2002


> I think we could and should create a function
> sanei_identify_device(char *device_file)
> 
> that has some
> #IFDEF _LINUX_
> test for major/minor number for SCSI/USB/PARALLEL/...
> #...

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).

The approach I have taken in coolscan2 is to use device names with a
prefix:

  usb:/dev/usb/scanner0

for instance. scanimage -L works (well, only for SCSI scanners at the
moment) because of the following code:

  try_interface = CS2_INTERFACE_SCSI;
  sanei_config_attach_matching_devices ("scsi Nikon *", cs2_attach);
  try_interface = CS2_INTERFACE_USB;
  sanei_config_attach_matching_devices ("usb Nikon *", cs2_attach);

I think that this approach is more robust than relying on interface
information obtained from the device file's major/minor number or such
like.

  Andras

===========================================================================
Major Andras
    e-mail: andras at users.sourceforge.net
    www:    http://andras.webhop.org/
===========================================================================



More information about the sane-devel mailing list