# Re: canon backend driver fix

From: Mitsuru Okaniwa (m-okaniwa@bea.hi-ho.ne.jp)
Date: Thu Jan 25 2001 - 19:50:22 PST

- Next message: Shea Martin: "sane 1.0.1/ how to disabe gimp compat"
  - Previous message: Nils Gundelach: "Re: Scanmaker 636"
  - In reply to: doj: "canon backend driver fix"
  - Next in thread: doj: "Re: canon backend driver fix"
  - Next in thread: Randolph Bentson: "Re: ADF scanner question"
  - Reply: doj: "Re: canon backend driver fix"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  Dear Mr.Doj

  I'm the CanoScan user.
  I have a CanoScan FB620S, and I'm using the model in SANE1.0.3 on Linux.
  About your patch, would you teach me ?

  ----- Original Message -----
  from: "doj" <doj@cubic.org>
  to : <sane-devel@mostang.com>
  sent : 22 Jan. 2001 at 5:57
  subject: canon backend driver fix

  > I am using an CanoScan 300. The 0.99 versions of SANE were working with
  > my scanner, but since v1.0 the driver complained.
  Are you using SANE 1.0.1 now ?
  Or SANE 1.0.3 ?

  > Now I have worked
  > myself through the sources and found some glitches, which I think result
  > from another bug beeing solved not 100% correct.
  What glitches did you have with a CanoScan 300 ?

  > With the patch I have attached everything is working fine with my system
  > again. I think the patch should work with others as well.
  I'm a beginner of SANE or Linux.
  And I have the problem the warning error at "make all" of Canon Backend(v
  991114) with SANE 1.0.3.
  It is a "warning: comparison between signed and unsigned".
  So, I think there is a hint with my problem in your patch.
  But I don't understand the parts of your modification well.
  Would you teach me the meaning of the following parts in your modification
  if you are OK ?

  ----------------------------------------------------------------------------

      ----
      > diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon-sane.c
      sane-backends-1.0.4.doj/backend/canon-sane.c
      > --- sane-backends-1.0.4/backend/canon-sane.c Sat Aug 12 17:09:02 2000
      > +++ sane-backends-1.0.4.doj/backend/canon-sane.c Sun Dec 31 00:36:39 2000
      > @@ -103,22 +103,22 @@
      >      for (dev = first_dev; dev; dev = dev->next)
      >      {
      >        if (strcmp (dev->sane.name, devnam) == 0)
      >   break;
      >      }
      > +  }
      > +  else
      > +  {
      > +    dev = first_dev;
      > +  }
      >
      >      if (!dev)
      >      {
      >        status = attach (devnam, &dev);
      >        if (status != SANE_STATUS_GOOD)
      >   return (status);
      >      }
      > -  }
      > -  else
      > -  {
      > -    dev = first_dev;
      > -  }
      >
      >    if (!dev)
      >      return (SANE_STATUS_INVAL);
      >
      >    s = malloc (sizeof (*s));
      > @@ -1065,11 +1065,11 @@
      >  /*   { */
      >  /*     DBG (1, "attach: GET SCAN MODE for scan control conditions
      failed\n"); */
      >  /*     sanei_scsi_close (s->fd); */
      >  /*     return (SANE_STATUS_INVAL); */
      >  /*   } */
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode control byte[%d] = %d\n", i, ebuf[i]);
      >    }
      >
      >    DBG (3, "attach: sending GET SCAN MODE for transparency unit\n");
      > @@ -1081,11 +1081,11 @@
      >    {
      >      DBG (1, "attach: GET SCAN MODE for transparency unit failed\n");
      >      sanei_scsi_close (s->fd);
      >      return (SANE_STATUS_INVAL);
      >    }
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode control byte[%d] = %d\n", i, ebuf[i]);
      >    }
      >
      >  #endif
      > @@ -1291,11 +1291,11 @@
      >    {
      >      DBG (1, "sane_start: GET SCAN MODE for scan control conditions
      failed\n");
      >      sanei_scsi_close (s->fd);
      >      return (SANE_STATUS_INVAL);
      >    }
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode byte[%d] = %d\n", i, ebuf[i]);
      >    }
      >  #endif
      >
      > diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon-scsi.c
      sane-backends-1.0.4.doj/backend/canon-scsi.c
      > --- sane-backends-1.0.4/backend/canon-scsi.c Sat Aug 12 17:09:02 2000
      > +++ sane-backends-1.0.4.doj/backend/canon-scsi.c Sun Dec 31 00:29:26 2000
      > @@ -377,11 +377,11 @@
      >      (page == SCAN_CONTROL_CONDITIONS)  ? 0x14 : 0x24;
      >
      >    memcpy (cmd + 10, data, (page == TRANSPARENCY_UNIT) ? 8 :
      >     (page == SCAN_CONTROL_CONDITIONS)  ? 16 : 24);
      >
      > -  for(i = 0; i < sizeof(cmd); i++)
      > +  for(i = 0; i <(int) sizeof(cmd); i++)
      >    {
      >      DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]);
      >    }
      >    cmdlen = (page == TRANSPARENCY_UNIT) ? 18 :
      >      (page == SCAN_CONTROL_CONDITIONS)  ? 26 : 34;
      > diff -w -b -B -u -U 5 -r -P sane-backends-1.0.4/backend/canon.c
      sane-backends-1.0.4.doj/backend/canon.c
      > --- sane-backends-1.0.4/backend/canon.c Sat Aug 12 17:09:03 2000
      > +++ sane-backends-1.0.4.doj/backend/canon.c Sun Dec 31 00:27:48 2000
      > @@ -226,11 +226,11 @@
      >    {
      >      DBG (1, "get scan mode failed: %s\n", sane_strstatus (status));
      >      return;
      >    }
      >
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode control byte[%d] = %d\n", i, tbuf[i]);
      >    }
      >    dev->tpu.Status = ( tbuf[2 + 4 + 5] >> 7 ) ?
      >      TPU_STAT_INACTIVE : TPU_STAT_NONE;
      > @@ -280,11 +280,11 @@
      >      DBG (1, "get scan mode failed: %s\n", sane_strstatus (status));
      >      perror("get scan mode failed");
      >      return;
      >    }
      >
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode control byte[%d] = %d\n", i, abuf[i]);
      >  /*    printf("scan mode control byte[%d] = %d\n", i, abuf[i]); */
      >    }
      >
      > @@ -594,11 +594,11 @@
      >    {
      >      DBG (1, "attach: GET SCAN MODE for scan control conditions
      failed\n");
      >      sanei_scsi_close (fd);
      >      return (SANE_STATUS_INVAL);
      >    }
      > -  for (i=0; i<buf_size; i++)
      > +  for (i=0; i<(int)buf_size; i++)
      >    {
      >      DBG(3, "scan mode byte[%d] = %d\n", i, ebuf[i]);
      >    }
      >
      >    DBG (3, "attach: sending (extended) INQUIRY\n");
      > @@ -1123,11 +1123,11 @@
      >
      >    /* Build the histograms */
      >    DBG(7, "sizeof(histo)='%lu'\n", (unsigned long) sizeof(histo));
      >    memset (histo, 0, sizeof(histo));
      >
      > -  for(i=0; i<bread; i+=3)
      > +  for(i=0; i<(int)bread; i+=3)
      >    {
      >  /*     j = (int)adjbuf[i] - 71; */
      >  /*     j = (j<0) ? -j : j; */
      >  /*     ++histo[RED][j]; */
      >      ++histo[RED][(int)adjbuf[i]];
      > Binary files sane-backends-1.0.4/core and sane-backends-1.0.4.doj/core
      differ
      >
      regards,
      Mitsuru Okaniwa
      --
      Source code, list archive, and docs: http://www.mostang.com/sane/
      To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

  - Next message: Shea Martin: "sane 1.0.1/ how to disabe gimp compat"
  - Previous message: Nils Gundelach: "Re: Scanmaker 636"
  - In reply to: doj: "canon backend driver fix"
  - Next in thread: doj: "Re: canon backend driver fix"
  - Next in thread: Randolph Bentson: "Re: ADF scanner question"
  - Reply: doj: "Re: canon backend driver fix"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  This archive was generated by hypermail 2b29 : Thu Jan 25 2001 - 20:41:24 PST