using ioctl in a C program to talk to a Xylogics tape drive

Joao Lin Yun yun at bu-ast.bu.edu
Wed Jun 5 04:40:00 AEST 1991


I've been trying to talk to a Xylogics tape drive through a C program including
the command "ioctl". For a reason unknown to me this does not work. I keep
getting the error message: "Inappropriate ioctl for device"
Here is the relevant piece of code that I'm using:

   struct mtop op;

         *fd = open("/dev/nrmt0", O_RDWR);

      op.mt_op = MTREW;
      *status = ioctl(*fd, MTIOCTOP, &op);
      if (*status < 0) {
         perror("mtio:");
         return;

The "open" command is successful (it returns a value of fd=8) but after that
any magtape opeartion that I try to do using "ioctl" gives an error:

	"mtio: Inappropriate ioctl for device"


The poeople from whom I got the code guarantee me that the code is working fine
with their SCSI tape drive (with /dev/nrst8 instead of /dev/nrmt0). After 
trying everything that seemed likely to be the problem, I have no idea of why 
it doesn't work. Can someone help finding the problem and a its solution?
Thanks!





More information about the Comp.sys.sun mailing list