DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Introduction to SCSI drivers

User-level access to SCSI devices

User-level processes can use the SCSIUSERCMD and SCSIUSERCMD2 ioctls to control SCSI peripheral devices, assuming the peripheral driver is coded with an ioctl( ) routine that defines SCSIUSERCMD and/or SCSIUSERCMD2. See the scsiHW) and scsi_usercmd(D3osdi) manual pages for more information.

Because the sense data may just be bundled at the end of the SCSI command, sense data is not normally available to user-level processes using the SCSIUSERCMD ioctl that is documented on the scsiHW) manual page and coded in the driver with the scsi_usercmd(D3osdi) functions. The driver can, however, be coded to return sense data to a user-level process with code such as the following:

   if (req_p->scsi_sense) {	/* If non-zero, then it is valid */
   	host_adp.sense_ptr = req_p->scsi_sense;
   	host_adp.sense_len = req_p->sense_len;
   }
   else {
   	host_adp.sense_ptr = ktop(&req_p->scsi_cmd.raw[req_p->cmdlen]));
   	host_adp.sense_len = (unsigned char) sizeof(struct scsi_sense);
   }

The SCO OpenServer 5 SCSI code samples package that is available from the HDK homepage provides code samples that illustrate how a user-level process calls SCSIUSERCMD.


© 2005 The SCO Group, Inc. All rights reserved.