NOTE: This interface description is not 100% up to date.

Look for the latest cdrecord-1.8 alpha in the alpah directory.

/*--------------------------------------------------------------------------*/
If you like to do a quick hack:

-	The interface funkctions are (currently):

	char * 
	scg_version(scgp, what) 
        	SCSI    *scgp; 
        	int     what; 

		return version information for SCSI transport

	char * 
	scg__version(scgp, what) 
        	SCSI    *scgp; 
        	int     what; 

		return version information for low level SCSI transport

	int
	scsi_open(scgp, device, busno, tgt, tlun)
		SCSI    *scgp; 
		char    *device; 
		int     busno; 
		int     tgt; 
		int     tlun; 

		prepare a handle for later use with scsi_send()

		busno = tgt = lun == -1 means preparing for SCSI bus scanning
		busno = tgt = lun == -2 and device filled up means open 'device'
				to get a handle.

	int
	scsi_close(scgp)
		SCSI	*scgp;

		close the actual handle to the SCSI driver.

	long
	scsi_maxdma(scgp)
		SCSI	*scgp;

		return the max. amount of contiguous DMA on the current
		architecture

	void *
	scsi_getbuf(scgp, amt)
		SCSI	*scgp;
		long	amt;

		allocate a (currently global - later open-specific)
		buffer of size 'amt' but not grater than scsi_maxdma()

	void
	scsi_freebuf(scgp)
		SCSI	*scgp;

		free the currelntly allocated DMA resources from 
		scgp.

	BOOL
	scsi_havebus(scgp, busno)
		SCSI	*scgp;
		int	busno;

		return TRUE/FALSE on whether the current machine
		includes a SCSI bus 'busno'

	int
	scsi_fileno(scgp, bus, tgt, tlun)
		SCSI	*scgp;
		int	bus;
		int	tgt;
		int	tlun;

		return a filedescriptor to be used for the SCSI
		send ioctl. The filedesscriptor must be the right
		one for bus/tgt/lun

	int
	scsi_initiator_id(scgp)
		SCSI	*scgp;

		return the SCSI initiator target ID asociated with the current
		bus, scgp points to.

	int
	scsi_isatapi(scgp)
		SCSI	*scgp;

		return 1 if the curent target is an ATAPI drive,
		return 0 if it is not an ATAPI drive,
		return -1 if we don't know.

	int
	scsireset(scgp)
		SCSI	*scgp;

		as it says, need not to be implemented.

	int
	scsi_send(scgp, f, sp)
		SCSI	*scgp;
		int	f;
		struct scg_cmd *sp;

		Simulate the scg SCSI send command ioctl.
		returns: -1 usage error(e.g.  EINVAL ....)
			 0 All other

		see scgio.h for a description of the fields in the struct.

		cmd->resid is set to the DMA residual count
	
		cmd->error is set to one of:
			SCG_NO_ERROR		SCSI transport without error
						this is true for most failed 
						commands too !!!!

			SCG_FATAL		could not select target

			SCG_TIMEOUT		a SCSI timeout occured

			SCG_RETRYABLE		any other case

		cmd->ux_errno is set to the UNIX errno for a 
		failed command (note: parameter error are covered above)
		If you have no "real" errno value available, use EIO.

		cmd->scb is set to the SCSI Status byte for the command
		note there is currently no sense status

		cmd->sense must be filled with auto-sense data if the
		comand fails.
		cmd->sense_count must be set to the # of valid sense bytes


If the library is ready, I will make a SCSI library test suite available.
but you need to be able to create certain SCSI error situations to test.


Jörg

 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fhg.de		(work) chars I am J"org Schilling
 URL:  http://www.fokus.fhg.de/usr/schilling   ftp://ftp.berlios.de/pub/schily