Commit 2b29b35e authored by Abel Deuring's avatar Abel Deuring

sanei_scsi.c: Fixed a buf in the rror handling for the Linux SG driver v3.x;

disabled direct IO by default
parent bc4002f3
......@@ -33,12 +33,12 @@ device mustek:/dev/scanner' is a Mustek ScanExpress 12000SP flatbed scanner
If this doesn't work you may have to add the right SCSI generic device name
to the configuration file. This should be documented in the man page for
your backend. To find out about the right SCSI device use sane-find-scanner:
your backend. To find out about the right SCSI device use tools/find-scanner:
# sane-find-scanner
sane-find-scanner: found scanner "SCANNER 2.02" at device /dev/scanner
sane-find-scanner: found scanner "SCANNER 2.02" at device /dev/sg0
sane-find-scanner: found scanner "SCANNER 2.02" at device /dev/sga
# tools/find-scanner
find-scanner: found scanner "SCANNER 2.02" at device /dev/scanner
find-scanner: found scanner "SCANNER 2.02" at device /dev/sg0
find-scanner: found scanner "SCANNER 2.02" at device /dev/sga
It may help to set a soft link /dev/scanner to the respective device.
......@@ -60,6 +60,16 @@ idescsi:
SANE. If your scanner isn't found or you encounter segmentation faults
try to disable idescsi.
Direct IO: Recent versions of the Linux SG driver for the 2.4 kernels support
direct IO, i.e., the SCSI adapter's DMA chip copies data directly to/from
user memory. Direct IO reduces memory usage and it may give better
throughput for very fast scanners, but it can lead to access conflicts,
if a backend uses shared memory. Sane does not use direct IO by default,
if you want to use it, run
configure --enable-directio=yes
Other Information
=================
......
......@@ -1693,7 +1693,6 @@ issue (struct req *req)
}
}
);
IF_DBG(if (DBG_LEVEL >= 255) system("cat /proc/scsi/sg/debug 1>&2");)
#ifdef SG_IO
}
else
......@@ -1916,7 +1915,16 @@ sanei_scsi_req_enter2 (int fd,
req->sgdata.sg3.hdr.sbp = &(req->sgdata.sg3.sense_buffer[0]);
/* 10 minutes should be ok even for slow scanners */
req->sgdata.sg3.hdr.timeout = 1000 * 60 * 10;
#ifdef ENABLE_DIRECTIO
/* for the adventurous: If direct IO is used,
the kernel locks the buffer. This can lead to conflicts,
if a backend uses shared memory.
OTOH, direct IO may be faster, and it reduces memory usage
*/
req->sgdata.sg3.hdr.flags = SG_FLAG_DIRECT_IO;
#else
req->sgdata.sg3.hdr.flags = 0;
#endif
req->sgdata.sg3.hdr.pack_id = pack_id++;
req->sgdata.sg3.hdr.usr_ptr = 0;
}
......@@ -1982,6 +1990,7 @@ sanei_scsi_req_wait (void *id)
}
else
{
IF_DBG(if (DBG_LEVEL >= 255) system("cat /proc/scsi/sg/debug 1>&2");)
ATOMIC (nread = read (req->fd, &req->sgdata.sg3.hdr, sizeof(Sg_io_hdr));
req->done = 1);
}
......@@ -2073,7 +2082,7 @@ sanei_scsi_req_wait (void *id)
else
{
/* check for errors, but let the sense_handler decide.... */
if ( (req->sgdata.sg3.hdr.info && SG_INFO_CHECK != 0)
if ( ((req->sgdata.sg3.hdr.info & SG_INFO_CHECK) != 0)
|| (req->sgdata.sg3.hdr.sb_len_wr > 0 &&
((req->sgdata.sg3.sense_buffer[0] & 0x7f) != 0)))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment