SIOC_INQUIRY

This IOCTL command collects the inquiry data from the device.

The data structure is
struct inquiry_data {
   uint   qual            :3,        /* peripheral qualifier              */
          type            :5;        /* device type                       */
   uint   rm              :1,        /* removable medium                  */
          mod             :7;        /* device type modifier              */
   uint   iso             :2,        /* ISO version                       */
          ecma            :3,        /* EMCA version                      */
          ansi            :3;        /* ANSI version                      */
   uint   aenc            :1,        /* asynchronous event notification   */
          trmiop          :1,        /* terminate I/O process message     */
                          :2,        /* reserved                          */
          rdf             :4;        /* response data format              */
   unchar len;                       /* additional length                 */
   unchar resvd1;                    /* reserved                          */
          uint            :4,        /* reserved                          */
          mchngr          :1,        /* medium changer mode (SCSI-3 only) */
                          :3;        /* reserved                          */
   uint   reladr          :1,        /* relative addressing               */
          wbus32          :1,        /* 32-bit wide data transfers        */
          wbus16          :1,        /* 16-bit wide data transfers        */
          sync            :1,        /* synchronous data transfers        */
          linked          :1,        /* linked commands                   */
                          :1,        /* reserved                          */
          cmdque          :1,        /* command queueing                  */
          sftre           :1;        /* soft reset                        */
          unchar vid[8];             /* vendor ID                         */
          unchar pid[16];            /* product ID                        */
          unchar revision[4];        /* product revision level            */
          unchar vendor1[20];        /* vendor specific                   */
          unchar resvd2[40];         /* reserve                           */
          unchar vendor2[31];        /* vendor specific (padded to 127)   */
};
An example of the SIOC_INQUIRY command is
#include <sys/IBM_tape.h>
char vid[9];
char pid[17];
char revision[5];
struct inquiry_data inqdata;
printf("Issuing inquiry...\n");
memset(&inqdata, 0, sizeof(struct inquiry_data));
if (!ioctl (fd, SIOC_INQUIRY, &inqdata)) {
   printf ("The SIOC_INQUIRY ioctl succeeded\n");
   printf ("\nThe inquiry data is:\n");
   /*-
    * Just a dump byte won't work because of the compiler
    * bit field mapping
   -*/
   /* print out structure data field */
   printf("\nInquiry Data:\n");
   printf("Peripheral Qualifer-----------------0x%02x\n", inqdata.qual);
   printf("Peripheral Device Type--------------0x%02x\n", inqdata.type);
   printf("Removal Medium Bit------------------%d\n", inqdata.rm);
   printf("Device Type Modifier----------------0x%02x\n", inqdata.mod);
   printf("ISO version-------------------------0x%02x\n", inqdata.iso);
   printf("ECMA version------------------------0x%02x\n", inqdata.ecma);
   printf("ANSI version------------------------0x%02x\n", inqdata.ansi);
   printf("Asynchronous Event Notification Bit-%d\n", inqdata.aenc);
   printf("Terminate I/O Process Message Bit---%d\n", inqdata.trmiop);
   printf("Response Data Format----------------0x%02x\n", inqdata.rdf);
   printf("Additional Length-------------------0x%02x\n", inqdata.len);
   printf("Medium Changer Mode-----------------0x%02x\n", inqdata.mchngr);
   printf("Relative Addressing Bit-------------%d\n", inqdata.reladr);
   printf("32 Bit Wide Data Transfers Bit------%d\n", inqdata.wbus32);
   printf("16 Bit Wide Data Transfers Bit------%d\n", inqdata.wbus16);
   printf("Synchronous Data Transfers Bit------%d\n", inqdata.sync);
   printf("Linked Commands Bit-----------------%d\n", inqdata.linked);
   printf("Command Queueing Bit----------------%d\n", inqdata.cmdque);
   printf("Soft Reset Bit----------------------%d\n", inqdata.sftre);

   strncpy(vid, inqdata.vid, 8);
      vid[8] = '\0';
   strncpy(pid, inqdata.pid, 16);
      pid[16] = '\0';
   strncpy(revision, inqdata.revision, 4);
      revision[4] = '\0';

   printf("Vendor ID-----------------------------%s\n", vid);
   printf("Product ID----------------------------%s\n", pid);
   printf("Product Revision Level----------------%s\n", revision);

   dump_bytes(inqdata.vendor1, 20, "vendor1");
   dump_bytes(inqdata.vendor2, 31, "vendor2");
}
else {
   perror ("The SIOC_INQUIRY ioctl failed");
   sioc_request_sense();
}