[sane-devel] SCSI problems with avision backend
Douglas Gilbert
dgilbert at interlog.com
Fri Apr 12 04:58:21 BST 2002
Henning Meier-Geinitz wrote:
> Hi,
>
> On Wed, Apr 10, 2002 at 10:01:51PM +0200, Henning Meier-Geinitz wrote:
>
>>Since the latest update of the avision backend I can't access my
>>Mustek (!) scanner anymore. It took some time to find out that the
>>reason is really the avision backend.
>>
>
> I think the bug is a missing sanei_scsi_close(fd) in attach() in the
> test:
>
> if (!found) {
> [...]
>
> If no Avision-Scanner is found, the fd must be closed.
>
> For some Reason since some versions the Linux kernel blocks access to
> a SCSI device if it's opened O_EXCL.
Henning,
If you open an sg device with O_EXCL and it is already open
then:
- if O_NONBLOCK is also set then the open() will fail
with EBUSY
- otherwise you will wait (interruptible) until the existing
open()s on that device are close()d.
For more details:
http://tldp.org/HOWTO/SCSI-Generic-HOWTO/open.html
> In erlier versions an error value
> was returned. I don't like the current behaviour because that
> effectivle stops me from using two scanners simultanously.
All scsi bus scans done using sg should use O_NONBLOCK else
they run the risk of hanging on somebody else's O_EXCL lock.
Doug Gilbert
More information about the sane-devel
mailing list