SCSI Pass-Through Programmer's Guide

command.flags = SCTL_READ;
command.cdb_length = 6;
command.cdb[0] = CMDinquiry; /* Inquiry */
command.cdb[4] = sizeof(struct inquiry_2); /* Allocation Length */
command.data = buf;
command.data_length = 64*1024;
command.max_msecs = timeout;
/*print_command ( command );*/
r = ioctl(fd, SIOC_IO, &command);
if (r) {
perror("ioctl");
fprintf(stderr, "SIOC_IO ioctl failed\n");
exit(4);
}
/*print_command ( command );*/
check_diag_command (command);
/* do an illegal command to test error stuff */
memset(command, 0, sizeof(struct sctl_io));
command.flags = SCTL_READ;
command.cdb_length = 6;
command.cdb[0] = 0x09; /* Invalid SCSI Command */
command.data = buf;
command.data_length = 64*1024;
command.max_msecs = timeout;
/*print_command ( command );*/
r = ioctl(fd, SIOC_IO, &command);
if (r) {
perror("ioctl");
fprintf(stderr, "SIOC_IO ioctl failed\n");
exit(4);
}
/*print_command ( command );*/
check_diag_command (command);
/* close the device file */
r = close (fd);
/* unlink (purge/delete) the device file we created */
r = unlink (file_name);
} /* end of main */
- 21 -