Hello all,
I finally got around to looking into my lockup problem. Turns out its
exactly the problem as described a couple months back by Lawrence and
someone else a couple of days again (sorry, I lost that email). With
some minor updates I can scan at any resolution, including 600 dpi. Its
even cured some random lockups I was getting at lower resolutions.
A point of interest is that Lawrence's fixes were related to the FD*
functions in snapscan-source.c (well, the RGBRouter_remaing() function
is used by both FD* and SCSI* functions). Under my scanner, It uses the
SCSI* function. I'm assuming that has to do with the blocking/non-block
support?
I took a different approach then Lawrence and modified the
snapscan-usb.c file so that usb_read() would try forever to read data if
it got a EAGAIN, just like the SCSI functions do. This works for both
FD* and SCSI* functions in snapscan-sources.c.
Anyways, I've attached the replacement function people can use for now
to get things working. I hope to have time to study the USB code and
rewrite it to support it proper (non-infinite retries, full features of
the sanei_scsi.c file, etc).
For now, here is what I have. Simply replace the same named function in
snapscan-usb.c:
SANE_Status usb_read(int fd, void *buf, int n) {
char dbgmsg[16384];
int r = -1;
static const char me[] = "usb_read";
while (r == -1)
{
r = read(fd,buf,n);
if (r == -1 && errno == EAGAIN)
{
/* FIXME: Should not retry forever. */
DBG(DL_MAJOR_ERROR, "%s: Received EAGAIN. Sleeping\n",me);
usleep(10000);
continue;
}
else if (r == -1)
break;
}
#if 0
if((r=read(fd,buf,n)) != n) {
DBG (DL_MAJOR_ERROR, "%s Only %d bytes read\n",me,r);
return SANE_STATUS_IO_ERROR;
}
#endif
DBG(DL_DATA_TRACE, "%s: reading:
%s\n",me,usb_debug_data(dbgmsg,buf,n));
if (r == -1)
return SANE_STATUS_IO_ERROR;
else
return SANE_STATUS_GOOD;
}
-- Chris Bagwell (mailto:cbagwell@sprynet.com) | Dallas, TX http://home.sprynet.com/~cbagwell | USA-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
This archive was generated by hypermail 2b29 : Mon Nov 06 2000 - 20:23:27 PST