Linux 2.0.33 and Sane 0.70

David Skoll (dskoll@chipworks.com)
Fri, 20 Feb 1998 14:37:58 -0500

Hi,

I am attempting to write a SANE driver for the Polaroid DMC, a high-end
CCD camera for microscopy applications. However, my driver hangs up in
one spot forcing me to reboot.

I'm running Linux 2.0.33 on an Intel system with SANE 0.70 and an
Adaptec 2940 SCSI card. The driver correctly causes the camera shutter
to trigger, but when I try to read the image data, it crashes.

Here's the relevant portion of the driver. If anyone has a DMC and
would like to help me out, I can send the entire driver code as it
stands now. I also have the DMC SCSI specs (in Word format -- bleh...)

Regards,

David.

/**********************************************************************
//%FUNCTION: DMCRead
//%ARGUMENTS:
// fd -- file descriptor
// typecode -- data type code
// qualifier -- data type qualifier
// maxlen -- tranfer length
// buf -- buffer to store data in
// len -- set to actual length of data
//%RETURNS:
// A SANE status code
//%DESCRIPTION:
// Reads the particular data selected by typecode and qualifier
//
*********************************************************************/
static SANE_Status
DMCRead(int fd, unsigned int typecode, unsigned int qualifier,
SANE_Byte *buf, size_t maxlen, size_t *len)
{
u_int8_t readCmd[10];
SANE_Status status;

/* Adjust byte length to multiple of image row size */
if (typecode == 0x00 && qualifier == 0x0000) {
maxlen = (maxlen / 2403) * 2403;
}
readCmd[0] = 0x28;
readCmd[1] = 0;
readCmd[2] = typecode;
readCmd[3] = 0;
readCmd[4] = (qualifier >> 8) & 0xFF;
readCmd[5] = qualifier & 0xFF;
readCmd[6] = (maxlen >> 16) & 0xFF;
readCmd[7] = (maxlen >> 8) & 0xFF;
readCmd[8] = maxlen & 0xFF;
readCmd[9] = 0;
DBG(3, "DMCRead: typecode=%x, qualifier=%x, maxlen=%d\n",
typecode, qualifier, maxlen);

*len = 0;

/* The next line HANGS! */
status = sanei_scsi_cmd(fd, readCmd, sizeof(readCmd), buf, len);

DBG(3, "DMCRead: Read %u bytes\n", *len);
return status;
}

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com