[sane-devel] make errors with 1.07

abel deuring adeuring at gmx.net
Sat Mar 9 14:39:33 GMT 2002


john meshkoff wrote:
> 
> System:  RH6.1, 2.2.19, GNU Make version 3.77.
> 
> I got the following, trying to make 1.07:
> 
> sanei_save_values.c: In function `sanei_save_values':
> sanei_save_values.c:99: warning: comparison between signed and unsigned
> sanei_save_values.c:127: warning: comparison between signed and
> unsignedI
> 
> sanei_scsi.c: In function `sanei_scsi_req_wait':
> sanei_scsi.c:2079: structure has no member named `host_status'
> sanei_scsi.c:2080: structure has no member named `host_status'
> sanei_scsi.c:2081: structure has no member named `host_status'
> sanei_scsi.c:2082: structure has no member named `driver_status'
> sanei_scsi.c:2083: structure has no member named `target_status'
> sanei_scsi.c: In function `lx_chk_id':
> sanei_scsi.c:2280: warning: unused parameter `host'
> sanei_scsi.c: In function `sanei_scsi_find_devices':
> sanei_scsi.c:2497: warning: assignment discards `const' from pointer
> target typemake[1]: *** [sanei_scsi.o] Error 1
> make[1]: Leaving directory `/usr/local/src/sane-backends-1.0.7/sanei'
> make: *** [all-recursive] Error 1

John,

That's my fault. When I fiddled with the error handling in sanei_scsi.c,
I forgot that old versions of sg.h did not have the fields host_status,
driver_status and target_status. 

As a quick fix, you can change the lines 2079 ff in sanei_scsi.c from:

if (   req->sgdata.cdb.hdr.host_status == DID_NO_CONNECT
    || req->sgdata.cdb.hdr.host_status == DID_BUS_BUSY
    || req->sgdata.cdb.hdr.host_status == DID_TIME_OUT
    || req->sgdata.cdb.hdr.driver_status == DRIVER_BUSY
    || req->sgdata.cdb.hdr.target_status == 0x04) /* BUSY */
/* if (req->sgdata.cdb.hdr.result == EBUSY) */
  status = SANE_STATUS_DEVICE_BUSY;

to

/* if (   req->sgdata.cdb.hdr.host_status == DID_NO_CONNECT
    || req->sgdata.cdb.hdr.host_status == DID_BUS_BUSY
    || req->sgdata.cdb.hdr.host_status == DID_TIME_OUT
    || req->sgdata.cdb.hdr.driver_status == DRIVER_BUSY
    || req->sgdata.cdb.hdr.target_status == 0x04) BUSY */
if (req->sgdata.cdb.hdr.result == EBUSY)
  status = SANE_STATUS_DEVICE_BUSY;

For a general fix, this should be done with configure, I think. 

The information from host_status and friends is quite useful, both for a
better error handling and for diagnosis, if sanei_scsi has a bug or if
something goes wrong inside the kernel, so I'd like to use these fields
if possible. The problem is that I am not very familiar with configure
-- is it possible to include a test like the following in configure?

- try to compile the test program:

#include <sys/types.h>
#include <scsi/sg.h>
int main(int argc, char **argv) 
{
  struct sg_header hdr;
  hdr.target_status = 1;
  return 0;
}

- if the succeeds, define HAVE_SG_TARGET_STATUS ; enclose the lines
above (and a preceding DBG statement) in #ifdef HAVE_SG_TARGET_STATUS .

Abel

- if this



More information about the sane-devel mailing list