[sane-devel] scsi scan command

jazz_johnson at verizon.net jazz_johnson at verizon.net
Thu Oct 25 13:56:07 UTC 2007


On Thursday 25 October 2007, m. allan noah wrote:
> did this help?
THANKS alot, yes it did!

>
> On 10/24/07, m. allan noah <kitno455 at gmail.com> wrote:
> > On 10/24/07, jazz_johnson at verizon.net <jazz_johnson at verizon.net> wrote:
> > > Where, according to the MANUAL,
> > >
> > > "the Transfer Length is the
> > > byte-length of the Window List transferred by the initiator in the
> > > DATA OUTPUT PHASE, and the Window List is a list of WIndow Identifiers
> > > created by the SET WINDOW command.
> > > Only one Window is supported with regard to Scan command. Therefore,
> > > 0 or 1 is used for Window Identifier, and 1 or 2 for Transfer Length."

From the RICOH description I wasn't sure whethor I was supposed to receive the list of available Window ID
from the scanner or send the Window ID list to the scanner. The latter was the correct meaning, .i.e.,
the Initiator is the backend, and the DATA OUTPUT PHASE is writing data to the scanner. So I made
the following modification to trigger_scan() and then it finally worked:

/* 1-3-8 SCAN command is used to instruct scanner to start scanning */
static SANE_Status
trigger_scan (HS2P_Scanner *s)
{
  static struct {
     START_SCAN  cmd;
     SANE_Byte      wid[2]; /* scanner supports up to 2 windows */
  }  scan;
  SANE_Status   status;

  memset (&scan, 0, sizeof (scan)); /* CLEAR scan */
  scan.cmd.opcode = HS2P_SCSI_START_SCAN;
  scan.cmd.len = (s->val[OPT_DUPLEX].w == SANE_TRUE)? 2 : 1 ;
  status = sanei_scsi_cmd (s->fd, &scan, sizeof(scan.cmd)+scan.cmd.len, NULL, NULL);

  return (status);
}


I finally scanned my first Ledger-sized pdf with scanimage.
Now I just need to hunt down some string pointer bugs in sane_control_option()
so that xsane handles options properly. The segfault I was getting was due to
s->val[ENDORSER_STRING].s not being initialized to an endorser_string[20] 
defined in typdef struct HS2P_Info. So the segfault is fixed now.

But I've still got some more string problems in sane_control_option() to fix, e.g.
my s->val[OPT_DITHER].s list is displaying not only my dither patterns, but also
strings from my other string lists.

Is an empty string in an array of strings the same as a NULL? ie. is
SANE_String_Const dither_list[]={ "pat1", "pat2", "" }  /*(pointer to '\0')*/
the same as
SANE_String_Const dither_list[]={ "pat1", "pat2", 0 }   /*(pointer = 0)*/



More information about the sane-devel mailing list