SIOC_MODE_SENSE_PAGE

This IOCTL command returns a mode sense page from the device. The page is selected by specifying the page_code in the mode_sense_page structure.

See the appropriate device manual to determine the supported mode pages and content.

The data structure is
struct mode_sense_page
  {
      char page_code;
      char data[MODESENSEPAGE];
  };
An example of the SIOC_MODE_SENSE_PAGE command is
#include <sys/Atape.h>

struct mode_sense_page mode_page;

/* get Medium Changer mode */
mode_page.page_code = 0x20;
if (!ioctl (fd, SIOC_MODE_SENSE_PAGE, &mode_page))
{
    printf ("The SIOC_MODE_SENSE_PAGE ioctl succeeded\n");
    if (mode_page.data[2] == 0x02)
       printf ("The library is in Random mode.\n");
    else
      if (mode_page.data[2] == 0x05)
        printf ("The library is in Automatic (Sequential) mode.\n");
}
else
 {
    perror ("The SIOC_MODE_SENSE_PAGE ioctl failed");
    sioc_request_sense();
}