STIOCQRYINQUIRY

This IOCTL command returns the inquiry data from the device. The data is divided into standard and vendor-specific portions.

The output data structure is
/*inquiry data info */
struct inq_data_s {
   BYTE b0;
   /*macros for accessing fields of byte 1 */
      #define PERIPHERAL_QUALIFIER(x) ((x->b0 &0xE0)>>5)
      #define PERIPHERAL_CONNECTED 0x00
      #define PERIPHERAL_NOT_CONNECTED 0x01
      #define LUN_NOT_SUPPORTED 0x03
      #define PERIPHERAL_DEVICE_TYPE(x) (x->b0 &0x1F)
      #define DIRECT_ACCESS 0x00
      #define SEQUENTIAL_DEVICE 0x01
      #define PRINTER_DEVICE 0x02
      #define PROCESSOR_DEVICE 0x03
      #define CD_ROM_DEVICE 0x05
      #define OPTICAL_MEMORY_DEVICE 0x07
      #define MEDIUM_CHANGER_DEVICE 0x08
      #define UNKNOWN 0x1F
   BYTE b1;
   /*macros for accessing fields of byte 2 */
      #define RMB(x) ((x->b1 &0x80)>>7)               /*removable media bit */
      #define FIXED 0
      #define REMOVABLE 1
      #define device_type_qualifier(x) (x->b1 &0x7F)  /*vendor specific */
   BYTE b2;
   /*macros for accessing fields of byte 3 */
      #define ISO_Version(x) ((x->b2 &0xC0)>>6)
      #define ECMA_Version(x) ((x->b2 &0x38)>>3)
      #define ANSI_Version(x) (x->b2 &0x07)
      #define NONSTANDARD 0
      #define SCSI1 1
      #define SCSI2 2
      #define SCSI3 3
   BYTE b3;
   /*macros for accessing fields of byte 4 */
      /* asynchronous event notification */
      #define AENC(x) ((x->b3 &0x80)>>7)
      /* support terminate I/O process message? */
      #define TrmIOP(x) ((x->b3 &0x40)>>6)
      #define Response_Data_Format(x) (x->b3 &0x0F)
      #define SCSI1INQ 0        /* SCSI-1 standard inquiry data format */
      #define CCSINQ 1          /* CCS standard inquiry data format    */
      #define SCSI2INQ 2        /* SCSI-2 standard inquiry data format */
   BYTE additional_length;      /* bytes following this field minus 4  */
   BYTE res5;
	BYTE b6;
		#define MChngr(x) ((x->b6 & 0x08)>>3)
   BYTE b7;
   /*macros for accessing fields of byte 7 */
      #define RelAdr(x) ((x->b7 &0x80)>>7)
      /* the following fields are true or false */
      #define WBus32(x) ((x->b7 &0x40)>>6)
      #define WBus16(x) ((x->b7 &0x20)>>5)
      #define Sync(x) ((x->b7 &0x10)>>4)
      #define Linked(x) ((x->b7 &0x08)>>3)
      #define CmdQue(x) ((x->b7 &0x02)>>1)
      #define SftRe(x) (x->b7 &0x01)
   char vendor_identification [8 ];
   char product_identification [16 ];
   char product_revision_level [4 ];
};
struct st_inquiry
{
   struct inq_data_s standard;
   BYTE vendor_specific [255-sizeof(struct inq_data_s)];
};
An example of the STIOCQRYINQUIRY command is
struct st_inquiry inqd;
if (ioctl(tapefd,STIOCQRYINQUIRY,&inqd)) {
   printf("ioctl failure.  errno=%d\n",errno);
   exit(errno);
}
if (ANSI_Version(((struct inq_data_s *)&(inqd.standard)))==SCSI2)
printf("Hey!  We have a SCSI-2 device\n");