On Wed, 25 Oct 2000 [EMAIL PROTECTED] wrote:
> >From: Giuseppe Corbelli <[EMAIL PROTECTED]>
>
> >I'm a wannabe SCSI programmer - I know, one of the most dangerous races
> >:-)). Since I'm developing some small apps using Mr SChilling's SCSI
> >library and cdrecord sources, and I'm going through the sources for the
> >lack of documentation, I thought about writing down some description of
> >all the routines I come over.
> >Are you interested in seeing what I've done? Up till now only 4 routines
> >~120 lines of linuxdoc sgml. I may post them here if you please.
>
>
> send me what you have, but note that I already started to write documentation.
There were problems with your address. I post it here so everyone can have
a look. Excuse me if this troubles you.
--
Giuseppe "Cowo" Corbelli -->> Riding on Linux-2.2.16
-<! God Knows How Long I Tried To Change Fate !>-
Blind Guardian - Mordred's Song
<!doctype Linuxdoc system>
<article opts="english">
<title>Joerg Schilling Unofficial API Documentation
<author>Giuseppe Corbelli<tt/<[EMAIL PROTECTED]>/
<date>v0.0.1, 12 October 2000
<abstract>
An unofficial overview of Joerg Schilling's API. For wannabe SCSI programmers.
</abstract>
<toc>
<sect>Functions
<sect1>extern SCSI *open_scsi __PR((char *scsidev, char *errs, int slen, int debug, int be_verbose));
<p>
<descrip>
<tag/Included in:/
<scsitransp.h>
<tag/Purpose:/
This routine opens a SCSI device and initializes error reporting. It is the first to be called in order to
use scglib.
<tag/Return value:/
Pointer to SCSI structure <it>(see scsitransp.h)</it>. Memory allocation is done internally.
<tag/Parameters:/
<itemize>
<item>char *scsidev is a pointer to the SCSI target identifier, as in the dev= parameter of cdrecord.
<item>char *errs is a pointer to an already allocated string.
<item>int slen is the lenght of errs.
<item>int debug is a boolean value. Only used to debug the library.
<item>int be_verbose. Guess what? :-)
</itemize>
<tag/Example:/
<code>
if ( (device = open_scsi(dev, errstr, sizeof(errstr), 0, 1)) == (SCSI *)0 ) {
P_error_printf("%s%sCannot open SCSI driver.\n", errstr, errstr[0]?". ":"");
exit (EXIT_FAILURE);
}
</code>
</descrip>
<sect1>extern void scsi_settimeout __PR((SCSI * scgp, int timeout));
<p>
<descrip>
<tag/Included in:/
<scsitransp.h>
<tag/Purpose:/
This routine sets the default timeout for scsi commands in milliseconds. Should be called before any SCSI cmd
IO and after opening scsi_device.
<tag/Return value:/
None.
<tag/Parameters:/
<itemize>
<item>SCSI *scgp is a pointer to an object obtained from open_scsi.
<item>int timeout is the requested timeout in milliseconds. Should be at least 40.
</itemize>
<tag/Example:/
<code>
scsi_settimeout(device, timeout);
</code>
</descrip>
<sect1>EXPORT BOOL do_inquiry __PR((SCSI *scgp, BOOL));
<p>
<descrip>
<tag/Included in:/
<scsi_cmds.c>
<tag/Purpose:/
This routine performs an INQUIRY command on the specified device. If verbose is TRUE results are printed on the stdout.
Please not this one is only a frontend to getdev() and printdev() functions, which are defined in scsi_cdr.c
<tag/Return value:/
TRUE if TRUE is given. FALSE if FALSE is given. You get what you pay for :-)))
<tag/Parameters:/
<itemize>
<item>SCSI *scgp is a pointer to an object obtained from open_scsi.
<item>BOOL is either TRUE or FALSE.
</itemize>
<tag/Example:/
<code>
if ( !do_inquiry(device, verbose) ) {
P_error_printf ("Cannot do inquiry for CD/DVD-Recorder.\n");
if (unit_ready(device)) P_error_printf ("The unit seems to be hung and needs power cycling.\n");
exit (EXIT_FAILURE);
}
</code>
</descrip>
<sect1>EXPORT BOOL unit_ready __PR((SCSI *scgp));
<p>
<descrip>
<tag/Included in:/
<scsi_cdr.c>
<tag/Purpose:/
This routine performs TEST UNIT READY command to test if unit is ready. Please note this is only a frontend to
test_unit_ready() which is defined in scsi_cdr.c and does all the dirty work.
<tag/Return value:/
FALSE if return value has no extended Sense and sense code is NOT_READY (0x04).
TRUE in all other cases.
<tag/Parameters:/
<itemize>
<item>SCSI *scgp is a pointer to an object obtained from open_scsi.
</itemize>
<tag/Example:/
<code>
See do_inquiry() example.
</code>
</descrip>
</article>