# Re: problems with Canon scanner

From: abel deuring (a.deuring@satzbau-gmbh.de)
Date: Sun May 07 2000 - 05:21:32 PDT

- Next message: Joachim Ansorg: "Re: gimp plug-in 1.1.21"
  - Previous message: Henning Meier-Geinitz: "README updates?"
  - In reply to: abel deuring: "Re: problems with Canon scanner"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  abel deuring wrote:

  >
  > SANE_Status sanei_scsi_req_enter2 (int fd,
  > const void * cmd, size_t cmd_size,
  > const void * src, size_t src_size,
  > void * dst, size_t * dst_size,
  > void **idp);
  >
  > SANE_Status sanei_scsi_cmd2 (int fd,
  > const void * cmd, size_t cmd_size,
  > const void * src, size_t src_size,
  > void * dst, size_t * dst_size);
  >
  > These functions would work like sanei_scsi_req_enter and sanei_scsi_cmd,
  > except that *src now contains only the "real data" to be sent to the
  > device, while *cmd contains the SCSI command.
  >
  > I could write an implementation for Linux during the next days, but I
  > would like to hear if there are other things missing. And of course it
  > does not make very much sense to write only the Linux part...

  ok, attached are diff outputs against sane-1.0.2 for sanei/sanei_scsi.c,
  include/sane/sanei_scsi.h, backend/canon-scsi.c and backend/sharp.c.
  The modifications introduce the functions
  SANE_Status sanei_scsi_req_enter2 (int fd,
  const void * cmd, size_t cmd_size,
  const void * src, size_t src_size,
  void * dst, size_t * dst_size,
  void **idp)
  SANE_Status sanei_scsi_req_cmd2 (int fd,
  const void * cmd, size_t cmd_size,
  const void * src, size_t src_size,
  void * dst, size_t * dst_size)
  Because the SCSI command block and the data to be written to the device
  are now in different locations, there is no longer the need to guess the
  command length. This should avoid the need to patch the Linux kernel in
  order to use Canon scanners.
  I changed these functions for _all_ operating systems. But since I am
  not able to test these changes except for Linux, and since I donīt want
  to mess up Saneīs SCSI library, I did not upload them to the CVS
  server.
  But of course I would appreciate tests of the modified SCSI library for
  the different OSes. Because the old functions sanei_scsi_cmd and
  sanei_scsi_req_enter now call the new functions sanei_scsi_cmd2 resp.
  sanei_scsi_enter2, every backend for a SCSI scanner can be used for
  these tests.
  The patch for canon-scsi.c uses the new function sanei_scsi_cmd2, where
  the vendor specfic SCSI commands are called. I am not sure, if I got the
  changes to the three affected functions (define_scan_mode,
  get_scan_mode, set_adf_mode) right, especially in define_scan_mode. I
  donīt have a Canon scanner at hand, so it is possible that the actual
  patch even makes things worse...

  The patch to the Sharp backend simply replaces sanei_scsi_cmd with
  sanei_scsi_cmd2 at a few points. It doesnīt introduce any new
  functionality, but should simply show, that the new function actually
  works.
  The part "#if USE == BSD_INTERFACE" of sanei_scsi.c contains in line
  2288 a comment, where I did not understand the original source: The size
  of the data block (without the SCSI command block) to be send to the
  device was src_size, not src_size - cdb_size, so that the kernel might
  read past the end of the data, in my understanding. Whatsoever, my
  changes declare a shorter data block, so either I fixed a bug, or I
  introduced one.
  Regarding the part "#if USE == OPENSTEP", starting at line 2484, it
  seems that the Openstep SG driver (or hoewever it is called) must guess
  the length of the SCSI command: There was and is not statement that sets
  something like "hdr.sr_cdb_size". Is that correct? If it is, is there a
  need to set the CDB length for vendor specific commands?
  Abel

  - application/octet-stream attachment: sanei_scsi.diff

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

  - Next message: Joachim Ansorg: "Re: gimp plug-in 1.1.21"
  - Previous message: Henning Meier-Geinitz: "README updates?"
  - In reply to: abel deuring: "Re: problems with Canon scanner"
  - Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

  This archive was generated by hypermail 2b29 : Sun May 07 2000 - 11:44:26 PDT