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

abel deuring adeuring at gmx.net
Sun Feb 10 13:55:59 GMT 2002


Henning Meier-Geinitz wrote:
> 
> Hi,
> 
> On Sun, Feb 03, 2002 at 01:06:12PM -0500, Douglas Gilbert wrote:
> > Just a suggestion ... once SANE spots a SCSI, USB, parport
> > etc. scanner it should hold open a file descriptor to it. If
> > the scanner is hot unplugged you should get a sensible
> > error message next time you try to access it (e.g. ENODEV).
> > By keeping a fd open to a device the module subsystem
> > (or the user) is inhibited from "autocleaning" the module
> > away. If that happens then the next time you open /dev/sg2
> > (for example) it may not be the scanner you expect it to
> > be! SANE could then have a high level function to rescan
> > for devices. Hooks could also be added so hotplug (and unplug)
> > alerts could be consumed sensibly. A common case would be
> > users power cycling their scanners.
> 
> One problem with this is that you can't have two backends that support
> the same scanner. The first backend will open the device and keep it
> open so the other backend has no chance to check the device.
> 
> But I will try if it can be done.

There might be more problems: 

- Assume that somebody starts xsane, makes a scan using a scanner
accessible via /dev/sgX from his desktop Linux box, and then leaves his
workplace for lunch, while xsane is still running. Next, somebody else
tries to access the same scanner via saned. This can't work, if xsane
has the file descriptor open. This could probably be avoided, if access
to this scanner is only allowed via saned, but I don't like this
restriction.

- Even if a scanner can only be accessed via saned, keeping a device
file descriptor open for a long time will prevent access to the scanner
by other software like vuescan. So we'll effectively claim a scanner
access monopoly for Sane ;)

For SCSI devices, devfs avoids most of the problems, except perhaps a
changing host number. Other busses like USB or Firewire are probably not
that easy to handle; I don't know much about them, but I wonder if there
are other ways to identify a device, like a serial number.

Abel



More information about the sane-devel mailing list