[sane-devel] avision: Out of memory

abel deuring a.deuring@satzbau-gmbh.de
Fri, 07 Feb 2003 16:13:32 +0100


Rene Rebe wrote:
> 
> Hi.
> 
> On: Thu, 6 Feb 2003 09:44:32 +0100,
>     Henning Meier-Geinitz <henning@meier-geinitz.de> wrote:
> > Hi,
> >
> > On Thu, Feb 06, 2003 at 01:24:37AM +0100, Rene Rebe wrote:
> 
> > That's suspicious. I don't think you can ignore
> > sanei_scsi_max_request_size. If you send larger requests, it won't work.
> > But maybe I'm missing something here?
> >
> > IIRC the default size is 128 kb on Linux (and may be lower on other
> > systems). So if the inquiry buffer size is bigger than that, it won't
> > work. You could use sanei_scsi_open_extended to set a bigger SCSI size. But you
> > still must check if the bigger size was accepted.
> 
> Hm. It works just fine reading 160kB using hpusbscsi on my HP Scanjet
> 5300 ... - Just vanilla source, nothing hacked.
> 
> Maybe I should use the sanei_scsi_open_extende and modify the
> hpusbscsi module to let me pass such a huge amount of data ... (As far
> as I can tell such a big transfer is currently only needed for the USB
> devices. The SCSI ones can return the calibration data in smaller
> junks ...)

Using sanei_scsi_open_extended is probably the best solution, because
you can specify different buffer sizes for each device file. But you
should be aware that you don't always get the beffer size you requested.
For some OSes, sanei_scsi.c simply sets a certain maximum size. I don't
know, if this is a hard limit for all OSes, or if you can issue commands
with larger data blocks. Another example are ISA adapters under Linux;
for these adapters, the max buffer size is < 64 kB. Some SCSI/USB
"translators"  for Linux limit the buffer size too, IIRC. In these case,
sending a larger buffer will never succeed. In short: I think that it is
better not to try to send more data than specified by
sanei_scsi_max_request_size (if sanei_scsi_open is used) or as returned
by sanei_scsi_open_extended. Alternatively, you can try to send more
data, but in this case the backend should hanlde the "no memory" error
more gracefully. 

Abel