[sane-devel] make errors with 1.07

john meshkoff johnm@sivakalpa.org
Sat, 09 Mar 2002 10:20:39 -0800


abel deuring wrote:
> 
> 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;
> 

	I'm no programmer, but I think I can handle that.


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

	I don't quite understand what that would entail.

> 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?

	I don't know how to "include a test like the following in configure"; a
hint would be helpful, but see below

> 
> - try to compile the test program:

would compiling the test program be done like this: 'gcc -o test
test.c'?

> 
> #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 .
> 

	I've downloaded a C course from

http://www.strath.ac.uk/IT/Docs/Ccourse/ccourse.html

And will study it and try to figure out these instructions; 


Thanks again, John
-- 
John Meshkoff johnm at sivakalpa dot org
http://www.sivakalpa.org/
"I do not know that I know the self fully;
neither do I know that I know him not" ... from the Upanishads